Kiwiplan - VUE with systemd
Introduction
This document it to setup auto restart of the VUE services after a server restart.
Create The Following Files
kiwiplan@.service
sudo vi /etc/systemd/system/kiwiplan@.service
Place the following in the file
[Unit]
Description=Kiwiplan services for %I
After=network-online.target mariadb.target
[Service]
Type=simple
User=remuser
Group=kiwiplan
ExecStart=/KIWI/services/servers.sh start %i
ExecStop=/KIWI/services/servers.sh stop %i
RemainAfterExit=true
PrivateTmp=false
LimitNOFILE=32768
LimitNPROC=32768
Environment=TERM=vt100
[Install]
WantedBy=multi-user.target
Reload the changes
sudo systemctl daemon-reload
servers.sh
vi /KIWI/services/servers.sh
Place the following in the file
#!/bin/bash
if [ $# -gt 1 ]; then
export TERM=vt100
export LOG=/tmp/kiwiplan.$2.log
echo $(date +'%Y-%m-%d %H:%M:%S') - $1 >> $LOG
case "$1" in
start)
/KIWI/services/sites/$2/current/bin/startservers.sh >> $LOG 2>&1
;;
stop)
/KIWI/services/sites/$2/current/bin/stopservers.sh >> $LOG 2>&1
;;
*)
exit 1
;;
esac
exit 0
else
echo "No Site passed"
exit 1
fi
Make the file executable
chmod +x /opt/kiwi/services/servers.sh
Run Configurations
For the VUE site named 'vue' use the following:
To have it start on boot run :
systemctl enable kiwiplan@vue.service
To stop it from starting at boot time :
systemctl disable kiwiplan@vue.service
To start :
systemctl start kiwiplan@vue.service
To stop :
systemctl stop kiwiplan@vue.service
To view status :
systemctl -l status kiwiplan@vue.service