Thursday, 15 May 2014

shell - Crontab, scheduled jobs, on holidays -


I wrote a shell script to monitor the rest of the API, when it is below, then Shell Script has two mails for the developer The second problem for the manager is that I need this frequency with this frequency:

  • During work hours every 9 minutes (9-18 hours) during work Runs and sends mail to manager and developer

  • On weekdays, between 6-9 pm and 18 to 24h Sends mail to manager issues and sends.

  • Send mail every 3 00:00 to 6:00 per night and hours of holidays and manager

¿ How can I stop the holidays and work days?

You will need several entries:

  1. every 15 minutes during office hours

    * / 15 09-18 * * * yourscript.sh

  2. Send email to manager only, if inside the script Add someone who will check the time and send it to the manager only

    00 06-09,18-23 * * * yourcript.sh

  3. Each three Send To Hours

    00 003,0 * * * yourcript.sh

To run on the holidays, Crohn will not be able to help you, a You will need to get a file from the source looking, which lists all the holidays and then adds to your script

  #! / Bin / sh if [grep -q` date +% f` /random_location/holidays.txt]; Then after leaving the 0 to # continue your script here  

No comments:

Post a Comment