running app as service ubuntu

By | July 28, 2021

sudo vi /etc/systemd/system/coba.service

[Unit]
Description=aplikasi coba
[Service]
User=system
WorkingDirectory=/home/system/coba
ExecStart=/home/system/coba/coba.sh
Restart=always
[Install]
WantedBy=multi-user.target

Reload the service files to include the new service.
sudo systemctl daemon-reload

Start your service
sudo service coba start

To check the status of your service
sudo service coba status

To enable your service on every reboot
sudo systemctl enable coba

To disable your service on every reboot
sudo systemctl disable coba