I have a bash script that runs on a machine (called lazyguy) that is usually turned off. Every night, lazyguy wakes up at a known time programmed in the BIOS, does a bunch of processing and inserts data to its Postgres database. Then, it goes to sleep (database and all).
How can get notified when the script did NOT run? Ideally, I'd like to get an email notification if nothing was inserted to the database or if the script exited with a non-zero return value. I definitely need to check for both conditions in case lazyguy ignored his alarm and slept in..again.
I have another machine (taskmaster) that is always running but has limited resources. Some thoughts:
Have lazyguy send some sort of message to taskmaster to indicate that he finished his chores (maybe with a count of rows inserted). Then, taskmaster will check for his report everyday at a certain time. If it's not there, email me and I'll send the goons to beat up lazyguy.
Have taskmaster wakeup lazyguy directly with a WakeOnLan packet, wait two minutes, run the script via ssh, and check the number of rows in the database for the day. If anything goes bad, email me.
Which approach is better? Is there an easier way to do this? Which technologies would you use? I'm thinking maybe some mix of crontab, mailx, logger, and maybe rsyslog.