Low Orbit Flux Logo 2 F

Service as Root

/usr/local/bin/test1.sh

#/!/bin/bash while : do echo “Running …” logger $(date) sleep 10 done

chmod +x /usr/local/bin/test1.sh

/etc/systemd/system/test1.service

[Unit] Description= Simple test service

[Service] Type=simple ExecStart=/usr/local/bin/test1.sh

[Install] WantedBy=multi-user.target

sudo chmod 664 tracker.service sudo systemctl daemon-reload

sudo systemct enable tracker sudo systemct start tracker sudo systemct status tracker

sudo cat /var/log/syslog

Service as Non-root

[Unit] Description= Simple test service After=network.target nss-lookup.target StartLimitIntervalSec=0

[Service] Type=simple Restart=always RestartSec=1 User=prduser ExecStart=/usr/local/bin/test1.sh

[Install] WantedBy=multi-user.target

More Info

Type = simple # for a program that starts and just keeps running, sucess right after fork Type = exec # almost the same, sucess after both fork and binary up and running Type = forking # for a program that daemonizes itself ( launcher returns after forking ) Type = oneshot # for one shot serrvices that don’t keep running