Move the log after stopping so there's one lapse per entry.

This commit is contained in:
Skylar Grant 2024-06-25 18:18:35 -04:00
parent 1986182d61
commit 8deaafc906
2 changed files with 11 additions and 3 deletions

View File

@ -25,7 +25,7 @@ SYNC_DES_PATH -- Complete path to sync destination directory
CRON_DIR -- Complete path to your system's cron.d directory CRON_DIR -- Complete path to your system's cron.d directory
CRON_FILE -- What to name the cron job file. CRON_FILE -- What to name the cron job file.
CRON_FREQUENCY -- Will get set by the script when starting a time lapse CRON_FREQUENCY -- Will get set by the script when starting a time lapse
CRON_LOG_PATH -- Complete path to output log location, including filename CRON_LOG_FILE -- Complete path to output log location, including filename
CRON_JOB -- Text of the cron job, starting with the user, do not include frequency here CRON_JOB -- Text of the cron job, starting with the user, do not include frequency here
``` ```

View File

@ -10,8 +10,8 @@ SYNC_DES_PATH="/mnt/media/TL/to-process"
CRON_DIR="/etc/cron.d" CRON_DIR="/etc/cron.d"
CRON_FILE="$CRON_DIR/timelapse" CRON_FILE="$CRON_DIR/timelapse"
CRON_FREQUENCY="" # Set by prompt CRON_FREQUENCY="" # Set by prompt
CRON_LOG_PATH="/var/log/${FILE_LIST[0]}.log" CRON_LOG_FILE="/var/log/${FILE_LIST[0]}.log"
CRON_JOB="root $INSTALL_DIR/${FILE_LIST[0]} >> $CRON_LOG_PATH 2>&1" CRON_JOB="root $INSTALL_DIR/${FILE_LIST[0]} >> $CRON_LOG_FILE 2>&1"
# Check for root/sudo # Check for root/sudo
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
@ -75,6 +75,14 @@ stop_tl() {
echo "Unable to remove to the file. Exiting" echo "Unable to remove to the file. Exiting"
exit 1 exit 1
fi fi
echo "Moving log file: $CRON_LOG_FILE"
mv "$CRON_LOG_FILE" "$CRON_LOG_FILE-bak"
if [[ $? -eq 0 ]]; then
echo "Success"
else
echo "Unable to move to the file. Exiting"
exit 1
fi
} }
# NAS Sync # NAS Sync