Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


admin_grundlagen:systemd_service_unit_files

Dies ist eine alte Version des Dokuments!


Beispiel für eine Service unit-file

/etc/systemd/system/nc.service
[Unit]
Description=my netcat service
 
[Service]
ExecStart=/usr/bin/nc -l -p 5000
 
[Install]
WantedBy=multi-user.target

Systemd Konfiguration neu laden

systemctl daemon-reload

Service starten

systemctl start nc

Start überprüfen

systemctl status nc

Beim Booten starten

systemctl enable nc

vmstat daemon service unit

/etc/systemd/system/vmstatd.service
[Unit]
Description=VMSTAT as a Service
 
[Service]
Restart=on-failure
RestartSec=10
EnvironmentFile=/etc/default/vmstatd
#ExecStart=/bin/bash -c 'exec /usr/bin/vmstat -n -w -t 3 >> /tmp/vmstat.log'
ExecStart=/bin/bash -c 'exec /usr/bin/vmstat $VMPARAM $VMDELAY >> $VMLOGFILE'
 
[Install]
WantedBy=basic.target
/etc/default/vmstatd
VMPARAM="-n -w -t"
VMDELAY="5"
VMLOGFILE="/tmp/vmstat.log"
admin_grundlagen/systemd_service_unit_files.1479981860.txt.gz · Zuletzt geändert: 2016/11/24 10:04 von stefan_miethke