Many people like to use /etc/rc.local
or @reboot
from cron so I will not say it is not the best choice. But I will give you some infos that you have to take attention by using this.
Since version Jessie Raspbian replaces classic SysV init for booting with systemd. To be compatible it emulates SysV and /etc/rc.local
is part of SysV. Look at Compatibility with SysV. You will find there:
Some SysV systems support an "rc.local" script that is supposed to be called "last" during boot. In systemd, the script is supported, but the semantics are less strict, as there is simply no concept of "last service", as the boot process is event- and request-based, parallelized and compositive. In general, it's a good idea to write proper unit files with properly defined dependncies, and avoid making use of rc.local.
For the same reason the starting conditions with @reboot
in crontab can change. man 5 crontab
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.
A boot order sequence isn't defined with systemd.