Skip to content

Instantly share code, notes, and snippets.

@lukestokes
Created February 1, 2018 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukestokes/695705fc89d037f6b0167ba416542103 to your computer and use it in GitHub Desktop.
Save lukestokes/695705fc89d037f6b0167ba416542103 to your computer and use it in GitHub Desktop.
Clears all log files every other day
#!/bin/bash
# clear_all_logs.sh
# Clear debug.log every other day
# Add the following to the crontab (i.e. crontab -e)
# 0 0 */2 * * ~/smartcash/clear_all_logs.sh
PREFIX="0"
START_NUMBER=$(<./start_number.txt)
END_NUMBER=$(<./end_number.txt)
for (( number=$START_NUMBER; number<=$END_NUMBER; number++ ))
do
if [ $number -gt 9 ]
then
PREFIX=""
fi
NODE="SmartNode$PREFIX$number"
echo "Clearing $NODE/debug.log..."
/bin/date > ~/smartcash/$NODE/debug.log
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment