Stretch Startup Scripts

From embeddedTS Manuals
Revision as of 11:39, 17 July 2019 by Kris (talk | contribs) (Removed link to Jessie scripts. They included X information that is not always valid. Broke this out in to separate section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A systemd service can be created to start up headless applications. Create a file in /etc/systemd/system/yourapp.service

[Unit]
Description=Run an application on startup

[Service]
Type=simple
ExecStart=/usr/local/bin/your_app_or_script

[Install]
WantedBy=multi-user.target

If networking is a dependency add "After=network.target" in the Unit section. Once you have this file in place add it to startup with:

# Start the app on startup, but will not start it now
systemctl enable yourapp.service

# Start the app now, but doesn't change auto startup
systemctl start yourapp.service
Note: See the systemd documentation for in depth documentation on services.