Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4872

Other programming languages • Re: Bash: How to extract value of named value?

$
0
0
Can a script run as a service on Linux?
Any executable script or program can be run as a service, all you need is a xxx.service file in /etc/systemd/system then enable that with sudo systemctl enable xxx.service and start it with sudo systemctl start xxx.service.

Code:

[Unit]Description=Glow gas readingsWants=network.target[Service]ExecStart=/usr/local/bin/glowShortStandardOutput=syslogStandardError=syslogSyslogIdentifier=glowgasRestart=alwaysRestartSec=5RuntimeMaxSec=86400[Install]WantedBy=multi-user.target
That glowshort.service file runs /usr/local/bin/glowShort as a systemctl service. It gets logged to journalctl -u glowshort.service

Statistics: Posted by DougieLawson — Thu Jun 13, 2024 10:39 pm



Viewing all articles
Browse latest Browse all 4872

Trending Articles