Stretch Startup Scripts: Difference between revisions

From embeddedTS Manuals
(Created page with "{{:Jessie Startup Scripts}}")
 
(Removed link to Jessie scripts. They included X information that is not always valid. Broke this out in to separate section)
 
Line 1: Line 1:
{{:Jessie Startup Scripts}}
A systemd service can be created to start up headless applications.  Create a file in /etc/systemd/system/yourapp.service
<source lang=ini>
[Unit]
Description=Run an application on startup
 
[Service]
Type=simple
ExecStart=/usr/local/bin/your_app_or_script
 
[Install]
WantedBy=multi-user.target
</source>
 
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:
<source lang=bash>
 
# 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
</source>
 
{{Note|See the [http://www.freedesktop.org/software/systemd/man/systemd.service.html systemd documentation] for in depth documentation on services.}}

Latest revision as of 11:39, 17 July 2019

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.