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 ./proc_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. 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
. So I came up with below systemd
script: Let me know if this is the right way as I am doing it for the first time?
[Unit]
Description=test server
After=network.target
StartLimitIntervalSec=0
[Service]
User=goldy
Group=goldy
Type=simple
WorkingDirectory=/opt/hold/data_server
ExecStart=/opt/hold/data_server/proc_server --init_file=../config/tree.init --port=8080 --dir=/data/hold/ --max_sec=2400 --max_mb=100 --active=5
Restart=always
RestartSec=3
LimitNOFILE=100000
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
Whenever I run above script, it gives me this error, I am not sure whats wrong?
[/lib/systemd/system/queue_server_two.service:3] Unknown lvalue 'StartLimitIntervalSec' in section 'Unit'