Python Forum
Py script that triggers ever 3 hours, but only between 9:15 am to 3:30 pm, Mon to Fri
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Py script that triggers ever 3 hours, but only between 9:15 am to 3:30 pm, Mon to Fri
#2
The classic way in Unix and Linux to schedule commands is cron. The cron daemon reads the cron tables of the users. These tables can be managed with the crontab command. The format is described in section 5 (type: man 5 crontab).

So you enter in a terminal window the command:
crontab -e
Then you enter the following lines:
Output:
#min hour monthday month weekday command 15 9,12,15 * * 1-5 /usr/bin/python3 /home/username/bin/script.py >>/home/username/output.txt 2>&1
Meaning:
Output:
15 : the minute of the hour when the command should run 9,12,15 : the hours on which the command should run * : the day of the month when the command should run (* = all) * : the monthin which the command should run (* = all) 1-5 : the day of the week the command should run (mon - fri) /usr/bin/python3 /home/username/bin/script.py >>/home/username/output.txt 2>&1 : the command.
Reply


Messages In This Thread
RE: Py script that triggers ever 3 hours, but only between 9:15 am to 3:30 pm, Mon to Fri - by ibreeden - Jun-30-2021, 11:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Formatting DateTime string and and converting it from AM/PM to 24 hours tester_V 2 1,283 Jun-08-2024, 05:16 PM
Last Post: tester_V
  MatplotibTicks every 24 hours TamP 4 2,944 Oct-04-2022, 04:08 PM
Last Post: deanhystad
  Hello all! need help. calculating OT hours. no1up 5 3,008 Jul-30-2022, 10:00 PM
Last Post: rob101
  How to get utcnow + 2 hours? korenron 2 4,036 Mar-01-2021, 03:22 PM
Last Post: korenron
  Need to add hours min and seconds tester_V 5 4,406 Jun-02-2020, 05:29 PM
Last Post: tester_V

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020