User Tools

Site Tools


ubuntu:startup_service:unit_file

Ubuntu - Startup Service - Unit File

Unit files are generally located within the R/W filesystem at /etc/systemd/system.


Create a Service Startup

[Unit] Description=MyApp After=docker.service Requires=docker.service

[Service] TimeoutStartSec=0 ExecStartPre=-/usr/bin/docker kill busybox1 ExecStartPre=-/usr/bin/docker rm busybox1 ExecStartPre=/usr/bin/docker pull busybox ExecStart=/usr/bin/docker run –name busybox1 busybox /bin/sh -c “while true; do echo Hello World; sleep 1; done”

[Install] WantedBy=multi-user.target </file>


/etc/systemd/system/couchpotato.service
[Unit]
Description=CouchPotato application instance
After=network.target
 
[Service]
ExecStart=/usr/bin/authbind --deep /opt/CouchPotatoServer/CouchPotato.py
Type=simple
User=peter
Group=peter
 
[Install]
WantedBy=multi-user.target

Test

systemctl daemon-reload
systemctl start couchpotato.service
systemctl status couchpotato.service
ubuntu/startup_service/unit_file.txt · Last modified: 2021/07/09 09:44 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki