Atm, I need to randomly start and stop (for lack of a better word in my mind) a job. I start it by typing
java -jar foo.jar and to stop it find out its pid and kill it. Killing it doesn't cause any data loss or corruption or anything, just FYI. Its tedious to do both these steps because the first command has to be executed from a particular directory, ie
/usr/share/jetty (The kill can be executed from anywhere).
So I was thinking something on the lines of
service foo start and
service foo stop to start and stop services. Is that possible, and more importantly correct? Is there any other solution?