Register the helloword service as a system service so it automatically starts
note: this is based on red hat, ubuntu would have a slightly different setting
Firstly create a service definition at:
/etc/systemd/system/helloworld.service
The minimum of the definition is as follows.
[unit]
Description=helloworld
[Service]
WorkingDirectory=/home/user
ExecStart=/bin/gunicorn -b 0.0.0.0:8080 sample:app_name
[Install]
WantedBy=multi-user.target
To enable the service to run as root
sudo systemctl enable helloworld
To disable a service
sudo systemctl disable helloworld
To start / stop a service
sudo systemctl start helloworld
sudo systemctl stop helloworld
To reload / restart. A reload ususally reloads all config files. Some apps are naughty and not picking up config files, so in that case a restart would work.
sudo systemctl reload helloworld
sudo systemctl restart helloworld
To check the service status
systemctl status helloworld
list the status of all services, enabled or not
sudo systemctl list-unit-files
check the status of services with name system
sudo systemctl list-unit-files | grep system