[GTALUG] How to run script at bootup in Debian

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Wed Jan 23 12:12:21 EST 2019


On Wed, Jan 23, 2019 at 11:11:24AM -0500, Stewart C. Russell via talk wrote:
> 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

Certainly.  If your command relies on something specific, it would be
best to make a proper startup handler for it.

The rc.local.server runs after the network is up.  That is all it
promisses.

As for cron, yeah timing of when that runs might not work for some things.

-- 
Len Sorensen


More information about the talk mailing list