[GTALUG] How to run script at bootup in Debian
Stewart C. Russell
scruss at gmail.com
Wed Jan 23 11:11:24 EST 2019
On 2019-01-23 9:43 a.m., Lennart Sorensen via talk wrote:
>
> Certainly using a file in /etc/cron.d with an @reboot time would work
> well too.
Though cron doesn't guarantee that useful services will be up when
@reboot is triggered. The hacky "it _almost always_ works" approach is
to put a 'sleep' of appropriate length before your command.
Writing a systemd service file isn't hard, though, and it allows fairly
fine-grained control over when/how it runs: after network start, as a
daemon or a one-shot, etc. I also like that you can run systemd services
as a user.
My better-than-nothing shutdown/reboot button for Raspberry Pi uses a
very simple service to ensure it stays running:
https://github.com/scruss/shutdown_button/blob/master/shutdown_button.service
cheers,
Stewart
More information about the talk
mailing list