I need a script in place that reboots a machine every third Friday of the month, and runs a script on the other Fridays in the month. since cron has no way of knowing how many weeks are in each month.One possible solution is to write a script that will determine how many weeks are in the month., then create marker files to determine what the current week is. For instance,
ls /tmp/weeks_since_reboot.*
weeks_since_reboot.3
will tell you that in this case, it's time to reboot the machine. Then after, the reboot, create a marker file in /tmp called weeks_since_reboot.0 until 1 week has passed, then weeks_since_reboot.1, etc.
Some months of the year have 5 Fridays, which could complicate things.
Please give me the solution for write a scrip.
Thanks in advance.
Karan
ls /tmp/weeks_since_reboot.*
weeks_since_reboot.3
will tell you that in this case, it's time to reboot the machine. Then after, the reboot, create a marker file in /tmp called weeks_since_reboot.0 until 1 week has passed, then weeks_since_reboot.1, etc.
Some months of the year have 5 Fridays, which could complicate things.
Please give me the solution for write a scrip.
Thanks in advance.
Karan