In my usecase, I am trying to write an upstart script for nginx service. Here is my content,
#nginx upstart script
description "start and stop nginx server"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
respawn
respawn limit 5 30
console output
exec service nginx start
But this does not work because we need to remove the pid
etc after stop and start.
Could someone help me with this? I am using amazon linux [ec2].