Use the information here to edit the /etc/crontab and then restart with synoservice -restart crond
http://www.multigesture.net/articles/how-to-use-cron-on-a-synology-nas/
1 2 | # /etc/crontab every 2 hrs at 15 minutes past 15 * /2 * * * root /root/checkAws .sh |
/root/checkAws.sh
1 2 3 4 5 6 7 8 | #!/bin/sh LOG= /root/checkAwsOutput .log SEND_EMAIL= /root/sendEmail .sh echo -n ` date ` > $LOG docker exec ubuntu2 aws s3 ls --summarize --human-readable --recursive s3: //myamazonbucket/Pictures | grep "Total Size:" >> $LOG 2>&1 $SEND_EMAIL |
// stolen from synology forum
/root/sendEmail.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/bin/sh taskname= "AWS Upload Check Total Size" ; out=$( /bin/echo "Email test output" ); status=$?; host=$( /bin/hostname ); eventuser=james@toggen.com.au eventmail1=james@toggen.com.au source /etc/synoinfo .conf; headers=` printf "From: %s - %s <%s>\r\n" "$host" "$mailfrom" "$eventuser" `; if [ ${ #eventmail2} -gt 0 ]; then to=` printf "%s, %s" "$eventmail1" "$eventmail2" `; else to=$eventmail1; fi ; outcome= "failed" ; if [ ${status} - eq 0 ]; then outcome= "been completed" ; fi ; outcome=` printf "%s on %s has %s" "$taskname" "$host" "$outcome" `; subject=` printf "%s %s" "$eventsubjectprefix" "$outcome" `; DATE_AND_TOTAL_SIZE=$( /bin/cat /root/checkAwsOutput .log); body=` printf "Dear user,\n\n%s\n\nTask: %s\n\nSincerely,\nSynology DiskStation\n\n" "$DATE_AND_TOTAL_SIZE" "$taskname" `; /usr/bin/php -r "mail('$to', '$subject', '$body', '$headers');" ; /usr/syno/bin/synodsmnotify "@administrators" "System Event" "${outcome}" ; |
0 Comments