I have a project and it is running a c program on the PI. The program is meant to start running at startup.
So far I have tried to do this with rclocal, but this is depricated. Afterwards I tried using SystemD, but I kept getting startup issues when the service tried to start. Now I would like to try crontab, but this is only documented for python.
Anybody who can help me out/got a solution?
crontab
will run ANY executable. If you want an answer you need to say what YOU tried – Milliways May 25 '18 at 08:59systemctl status yourservice
andjournalctl --pager-end --unit=yourservice
say? How looks theyourservice.service
file? Please address me with @ingo. Otherwise I don't get a notification about your comment. – Ingo May 25 '18 at 13:26man 5 crontab
. It says: "Please note that startup, as far as @reboot is concerned, is the time when the cron(8) daemon startup. In particular, it may be before some system daemons, or other facilities, were startup. This is due to the boot order sequence of the machine." So you may run into problems if your program needs specific services.systemd
is made for booting and can check dependencies. – Ingo May 26 '18 at 08:06@reboot
, but it's good to know! – Seamus May 26 '18 at 13:24@reboot
, may fail in future. – Ingo May 26 '18 at 20:32cron
implementations don't even implement the@reboot
option - perhaps that's why? Mea culpa: Without doing any research, I assumed those that did implement@reboot
did so with a "guarantee" thatcron
would be the last daemon to be started. A faulty assumption! But after all of that, it would seem that this is a reasonable work-around to the vagaries of whencron
gets started in the boot process:@reboot ( sleep 30 ; sh /home/pi/script.sh )
. Agree? – Seamus May 27 '18 at 14:43