User1: why "stop" would hang?
User1: start works, tracking PID is corret, when i do stop the process finishes succesfully, but the command itself hangs
User2: User1 what does "initctl status <job>" show? maybe you 'post-stop' is still running?
User1: i don't have post-stop. after some time i stopped it by Ctrl+C. status is "stop/killed, pid ...". then i tried to start it again and even start hanged
User2: User1 can you show me the conf file?
User1: User2 http://pastebin.com/nMV1s7YD
User2: User1 firstly, you need to be careful with those pre-start commands since if any fail, the job will not run. See http://upstart.ubuntu.com/cookbook/#develop-scripts-using-bin-sh
User1: User2 i understand, but that pre-start is the only solution for my case that i was talking about yesterday here
User2: User1 are you sure that Upstart is tracking the pid correctly? Does "nms" definately fork only once?
User1: it starts with no issues, after that "status" shows correct PID
User1: it even stops the process, but "stop" command doesn't finish
User1: User2 i have the simple script that you can use to reproduce the situation, let me paste it
User1: User2 http://pastebin.com/jityDGxg ( don't ask why it's been written in this way :) )
User1: User2 btw, are you going to add support for dependencies like SMF has? i was talking/complaing about it yesterday. i want to say that B depends on A so when B is started and A isn't running yet, A has to be started first.
User1: that is the only reason i have that pre-start hook - i don't want (and i haven't) to modify ntp/mongodb conf files, but i still want to be sure that the services are running
User2: User1 the problem is that your perl script is attempting to "manage" the service by killing the child. However, you've told Upstart that the child PID *is* the service so Upstart is tracking the forked child process. Either remove the "expect fork" or stop the perl script from killing the child - Upstart will do that for you as it kills the process group.
User1: User2 the wrapper doesn't kill the child (those INT/TERM handles only for developers). the simple is chain is: fork->exec->waitpid
User1: btw, does the upstart kill the process group of forked child or the parent?
User2: User1 please see my comments above.
User3: How can you tell upstart to get the pid from a pid file on the stop command
upstart
Ubuntu IRC