In this post, we will talk about how to configure your applications to run as a system service in Linux.
STEP 1. Make a backoffice.service file in /etc/systemd/system/ directory.
Description= Back office service
ExecStart=/usr/bin/env node /path/to/server/app.js
STEP 2. Run this command to make your daemon aware of your application.
STEP 3. Run this command to start your application.
systemctl start backoffice
systemctl enable backoffice
STEP 4. Check your application as a service
service backoffice status
journalctl -u backoffice
You can also use other services such as nohup, forever, pm2, etc. to configure your application or you can use Linux crontab as well to make your application available all the time.