Created
February 1, 2018 21:08
-
-
Save lukestokes/695705fc89d037f6b0167ba416542103 to your computer and use it in GitHub Desktop.
Clears all log files every other day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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