Search code examples
croncron-task

How to set a cron job to run at a exact date and time frame?


How can I set a cron to run every 30 mins between 8 am and 5 pm during the weekedays , here is my code but seems it not working

*/30 8-16 * * 1,2,3,4,5 cd /root/Desktop; ./script.sh

please help me to solve this


Solution

  • Try this ==>

    For Weekday

    */30 08-17 * * 1-5 /path_of_file
    

    For Weekend // Saturday, sunday

    */30 08-17 * * 0,6 /path_of_file
    

    */30 for every half hour

    08-17 for 8 AM to 5 PM

    1-5 for Monday to friday

    0,6 For Sunday and Saturday