Create Custom Service (Daemon) | Systemd
Create file:
sudo nano /etc/systemd/system/somename.service
[Unit]
Description=MyApp
[Service]
ExecStart=/usr/bin/somecommand start
ExecStop=/usr/bin/somecommand stop
Restart=always
User=nobody
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nogroup
WorkingDirectory=/home/ubuntu/SomeDir
[Install]
WantedBy=multi-user.target
Enable To Run On Boot:
sudo systemctl enable somename.service
Start, Stop, Status:
sudo systemctl start somename.service