I need some help with this; endless upon endless scripts look exactly the same -- yet I can't seem to stop the job associated with an upstart script. I'm using any of the newest Ubuntu Elestic AMIs on EC2, and it happens from micro to large instances.
At first, I hand a simple configuration in /etc/init/node-monitor.conf
to start a process:
description "node-monitor"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
exec sudo -u root sh -c "cd /home/ubuntu/node-monitor/run && /usr/local/bin/node client.js ec2=true debug=false console=true cloudwatch=true >> /var/log/node-monitor.log 2>&1 &"
This worked for starting:
sudo start node-monitor
node-monitor start/running, process 1580
But not stopping:
sudo stop node-monitor
stop: Unknown instance:
Then I tried something more complicated, based on another node.js project:
description "node-monitor"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
script
echo $$ > /var/run/node-monitor.pid
exec sudo -u root sh -c "cd /home/ubuntu/node-monitor/run && /usr/local/bin/node client.js ec2=true debug=false console=true cloudwatch=true >> /var/log/node-monitor.log 2>&1 &"
end script
pre-stop script
rm /var/run/node-monitor.pid
end script
But this didn't work either. What in Sam Hill am I doing wrong?