# Cronjobs _Run `crontab -e` to add..._ ```bash 33 3 * * * /home/J2897/Code/Bash/update_strat.sh >> /home/J2897/freqtrade/user_data/logs/strat_updates.log 33 15 * * 3 /home/J2897/Code/Bash/update_dc.sh >> /home/J2897/freqtrade/user_data/logs/dc_updates.log ``` ## update_dc.sh _Pulls the latest Docker Container and restarts..._ ```bash #! /usr/bin/bash cd '/home/J2897/freqtrade/' echo "$(date) - Pulling the most recent docker container... " docker compose down && docker compose pull && docker compose up -d echo "$(date) - Finished." ``` ## update_strat.sh _Updates the strategy file when it's released and restarts..._ ```bash #! /usr/bin/bash cd '/home/J2897/freqtrade/' echo "$(date) - Checking for strategy updates... " # Get file Modified date as a UTS. FILE1='/home/J2897/freqtrade/user_data/strategies/NostalgiaForInfinityX.py' FILE_UTS=$(stat --printf='%Y' $FILE1) # %Y is the time of last data modification in seconds since Epoch. # Get the published date of the latest release. get_release_date() { curl --fail --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release info from GitHub API. grep '"published_at":' | # Get date line. sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value. } # get_release_date() { # curl --fail --silent "https://api.github.com/repos/$1/releases/latest" | # jq -r .published_at # } # Update if there's a newer version. RAW_CODE_URL='https://raw.githubusercontent.com/iterativv/NostalgiaForInfinity/main/NostalgiaForInfinityX.py' # CURRENT_UTS=$(date '+%s') PUBLISHED_UTS=$(date -d "$(get_release_date 'iterativv/NostalgiaForInfinity')" '+%s') if [ $PUBLISHED_UTS -ge $FILE_UTS ]; then echo 'A newer version is available. Downloading...' curl --fail --silent "$RAW_CODE_URL" -o "$FILE1" docker compose down && docker compose up -d fi echo "$(date) - Finished." ``` ## Aliases _Add these to your `.bash_aliases` file..._ ```bash alias restart-dc='docker compose down && docker compose pull && docker compose up -d' alias update-dc='/home/J2897/Code/Bash/update_dc.sh' alias update-strat='/home/J2897/Code/Bash/update_strat.sh' ```