systemd - matthewfincher/blacksky GitHub Wiki
Overview of systemd for RHEL 7
create service file
sudo touch /etc/systemd/system/landscapes.service
sudo chmod 664 /etc/systemd/system/landscapes.service
sudo chmod +x /etc/systemd/system/landscapes.service
sudo vim /etc/systemd/system/landscapes.service
add service file content...
[Unit]
Description=Landscapes.io v2.0.0
After=mongod.service
[Service]
ExecStart=/home/ec2-user/landscapes.io/node_modules/nodemon/bin/nodemon.js /home/ec2-user/landscapes.io/server/init.js --exec babel-node
WorkingDirectory=/home/ec2-user/landscapes.io
Restart=always
RestartSec=10
Environment=NODE_ENV=production PROTOCOL=https PUBLIC_IP=landscapes.blacksky.io PORT=443
[Install]
WantedBy=multi-user.target
enable, start and check service...
sudo systemctl enable landscapes.service
sudo systemctl start landscapes.service
sudo systemctl status landscapes.service
Use journalctl to View and Manipulate systemd Logs
view logs...
journalctl -u landscapes.service --since today
remove service...
sudo systemctl stop landscapes.service
sudo systemctl disable landscapes.service
rm /etc/systemd/system/landscapes.service
rm /etc/systemd/system/landscapes.service
sudo systemctl daemon-reload
sudo systemctl reset-failed