Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 5159  / 1 Year ago, thu, february 2, 2023, 10:58:09

I have used the crontab to run a command that repeats every 30 minutes. From the tutorials, I written the following command to /etc/crontab



*/30 * * * * root /usr/bin/python /home/pi/do.py>>/home/pi/output



As per the tutorials found on google, it should run for 0,30,60...minutes. But it won't run at reboot. However, it runs for every 30 minutes after reboot.



If I use the command @reboot /usr/bin/python /home/pi/do.py>>/home/pi/output, then it will run at reboot. But actually, I need to run the command at boot and also for every 30 minutes.



How can I configure the same for a run at reboot also?


More From » 14.04

 Answers
4

You can’t combine both in one cron line, but there’s nothing wrong with simply having two lines, one for the start at boot and one for running the command every 30 minutes:



*/30 * * * * root /usr/bin/python /home/pi/do.py>>/home/pi/output
@reboot root /usr/bin/python /home/pi/do.py>>/home/pi/output

[#5608] Friday, February 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
looweets

Total Points: 52
Total Questions: 114
Total Answers: 111

Location: Turkmenistan
Member since Sat, Apr 16, 2022
2 Years ago
;