- Edit
sudo vi /etc/systemd/system/xguard.service
[Unit]
Description=Crossing Guard
Requires=network.target
After=syslog.target network-online.target
[Service]
Type=simple
User=panda
WorkingDirectory=/canvas-supports/crossing-guard
ExecStart=/usr/bin/ruby /canvas-supports/crossing-guard/guard.rb
ExecStop=/bin/kill -- $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGTERM
KillMode=process
Environment=SYSTEMD_LOG_LEVEL=debug
# if we crash, restart
RestartSec=30
Restart=always
# This will default to "bundler" if we don't specify it
SyslogIdentifier=xguard
[Install]
WantedBy=multi-user.target
-
Reload and Enable
sudo systemctl daemon-reload; sudo systemctl enable xguard -
Start the service
sudo systemctl start xguard -
Check the status
sudo systemctl status xguard.service -
Stop and Restart
sudo systemctl stop xguardsudo systemctl restart xguardsudo journalctl -u xguard.servicesudo journalctl -u xguard.service --since '1 hour ago'systemctl show xguard.service | grep -i restart