I have a upstart configuration file as shown below which works fine in Ubuntu 14:
#/etc/init/data_server.conf
#sudo start data_server
#sudo stop data_server
#sudo status data_server
start on runlevel [2345]
stop on runlevel [016]
chdir /opt/hold/data_server
respawn
post-start script
echo "data server started at `date +"%F %T"` on `hostname -f`" | mailx -r "abc@host.com" -s "data server Started" "pqr@host.com"
end script
post-stop script
sleep 30
end script
limit core unlimited unlimited
limit nofile 100000 100000
setuid goldy
exec ./data_server --init_file=../config/tree.init --port=8080 --dir=/data/hold/ --max_sec=2400 --max_mb=100 --active=5
Now we are moving to Ubuntu 16 so we can't use upstart
and looks like we need to use systemd
here. What are the changes I need to do to write script in systemd
?
I have to make sure whenever system is rebooted or app is killed it should start my systemd
script automatically which in turn start my data server
.