1

I have a number of servers that I want to perform the same jobs on, one server per day, once the final server has been acted upon the script should return to server1 and start over again.

The jobs are a series of scripts, doing different things, throughout the day.

My idea is to use cron to schedule the day's activities on server1. I'll use a script to setup the crontab for the day, and on the next day it'll clear the crontab and set up the jobs for server2. This 'scheduler' script will itself run daily via cron.

One bit I'm struggling with is how to persistently store which server is today (or which is tomorrow) then loop back to server1 when server9 is done. For persistence I reckon I'll need to store the state in a file but I don't know how to structure the file to achieve what I need.

Any advice?

1

Keep your cron on a single server (server1 ?) and then run the scripts remotely from the same controlling machine by setting up an ssh key:

ssh server2 /path/to/script

This way your jobs are all scheduled in one place, and you aren't recreating crons everywhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.