February 5, 2013

How to add a upstart task on RHEL6


Suppose the application you want to start is called myapp.

Become root and create a file under /etc/init/myapp.conf

start on stopped rc RUNLEVEL=[2345]

respawn
script
        cd /home/me/myapp
        ./myapp -i /home/me/myapp/system.ini
end script

Run "initctl start myapp" to start the app.
Run "initctl status myapp" to see the status.
Run "initctl stop myapp" to stop the app

Keep in mind that myapp should not daemonize itself. Upstart will do the daemonize part.

No comments:

Post a Comment