1

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?

mcv
  • 53

2 Answers2

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
dessert
  • 39,982
1

Use the following:

@reboot root /usr/bin/python /home/pi/do.py>>/home/pi/output
double-beep
  • 195
  • 1
  • 4
  • 12
pub
  • 11