service location
cd /usr/lib/systemd/system/
make shell to service(eg. autostart.service)
[Unit]
Description=auto restart java application when it updated
[Service]
Type=simple
ExecStart=/somepath/autostart.sh
TimeoutStartSec= 0
[Install]
WantedBy=multi-user.target
reload when service script changed
systemctl daemon-reload
AutoStart when reboot
systemctl enable swd-autostart.service
Restart service
sudo systemctl restart autostart.service
Check service log
systemctl status autostart.service -l
或查看 var/log/message