i writing script write output of df -g text file once week. here's script, think should work, whenever try , run root typing ./check_space.sh following error: ./check_space.sh: line 13: syntax error near unexpected token done' ./check_space.sh: line 13:
done'
#!/bin/bash #this script run every week grab df -g , output file. #times sleep #10080 = 1 week #date command now=$(date +"%m.%d.%y") while true, df -g > /sds/app/force/custom/dumplogs/harddisk/$now.log #sleep 10080 done
originally thinking of running script in screen session, why sleep in there, decided better run cron once week.
the problem caused comma after true
. correct syntax semicolon: while true; do
. don't need while loop in first place. following suffice:
#!/bin/bash now=$(date +"%m.%d.%y") df -g > /sds/app/force/custom/dumplogs/harddisk/$now.log
may suggest use %y-%m-%d
date format, make easier sort date.
Comments
Post a Comment