Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Only archive old logfile if it exists.
  • Loading branch information
yin committed Dec 29, 2013
1 parent 6c64099 commit b65f623
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/gekko_launch.sh
Expand Up @@ -3,12 +3,16 @@ cd ~/gekko

# zip previous log files for this config
now="`date +%Y%m%d%H%M%S`"
mv log/gekko_log.$1.txt log/gekko_log.$1.$now.txt
zip -vu log/gekko_logs.zip log/gekko_log.$1.$now.txt
current_log=log/gekko_log.$1.txt
archive_log=log/gekko_log.$1.$now.txt

# remove raw text files now that they're zipped
rm log/gekko_log.$1.$now.txt
if [ -f $current_log ]; then
mv log/gekko_log.$1.txt $archive_log
zip -vu log/gekko_logs.zip $archive_log

# finally launch gekko and log output to log file as well as stdout
node gekko config="config/user/$1.js" 2>&1 | tee log/gekko_log.$1.txt
# remove raw text files now that they're zipped
rm $archive_log
fi

# finally launch gekko and log output to log file as well as stdout
node gekko config="config/user/$1.js" 2>&1 | tee $current_log

0 comments on commit b65f623

Please sign in to comment.