SeboHi, is there anyone here?00:32
SeboCan you tell me how to make /etc/init/*.conf auto respawning job not to respawn if the main process ended while pre-stop is running?00:46
ryoohkimarrusl: thanks!06:51
SeboHi, is there anyone here?08:44
SeboCan you tell me how to make /etc/init/*.conf auto respawning job not to respawn if the main process ended while pre-stop is running?08:56
jhuntyou could call "stop" from pre-stop which will override the respawn stanza.08:57
jhunt(you don't need to specify the name of the job - just call "stop".08:58
SeboI think I did it but it does not help09:10
SeboI created /var/run/job.pid file at the beggining of the pre-stop 09:11
Seboand in the beggining of the pre-start I just check if there is this file and if the process with the pid given in it is running09:12
Seboand if it is I do # kill -0 `cat /var/run/job.pid` && { stop; exit 0;}09:14
jhuntI'm rather confused by what you're trying to do here.09:16
SeboI am trying to write a job for running VBox VM as a daemon. 09:17
SeboTherefore I created the script that exec vboxheadless -s TheVM09:18
jhuntso why do you need to cancel the respawn handling? If you stop that job via the command-line, it won't respawn and it should be stopped at system shutdown too?09:22
SeboSince the VM should be stopped by calling vboxmanage controlvm TheVM acpipowerbutton ...and that command causes the VM to poweroff the virtual system and after that the main process exits I made pre-stop script to call this command. And what I found out that such configuration makes stopping the job imposible. cause the main is respawned after it finishes at pre-stop09:23
jhuntthe problem is that you're asking Upstart to manage that pid of the server and they you are trying to take control back by invoking vboxmanage.09:27
SeboI'd like to ask upstart to manage the vboxheadless process i.e to restart it if it for some reason went down. Hovever I would like it to stop the process not by sending the term signal but by calling vboxmanage controlvm TheVM acpipowerbutton09:32
SeboAnd whats more I would suppose that if the main process went unexpectedly down the upstart will call pre-start before the respawn.09:35
jhuntI understand what you're trying to do now. Try running "vboxheadless" on the command line and then seeing what the exit code is when it is stopped by "vboxmanage controlvm". You should then be able to specify "normal exit ..." which will tell Upstart not to respawn it if it detects that exit code. (see "man 5 init" for details).09:39
SeboIt might be a good way :)and simple 09:44
jhuntyou just have to hope that the exit code when vboxheadless exits via "vboxmanage" is different to if vboxheadless does actually crash for some reason. If vboxmanage is cleanly shutting the VM down, you would *expect* the vboxheadless process to "exit 0", but from what you've described, that isn't happening so that could be a bug with VBox.09:46
SeboYep but I can make main script that'll check if the pre-stop is running and if so it could return some 'normal exit' code defined by myself09:48
SeboAnd I read at the upstart wiki that calling # stop JOB changes the JOB goal. How can i check inside the job scripts what the actual goal is?09:53
jhunt"status job" shows the goal09:54
jhuntMore on that in the cookbook: http://upstart.ubuntu.com/cookbook/#job-states09:55
SeboJ was just thinking of checking if the goal is 'stop' at the beggining of main and pre-start and if so just quit.09:57
pmjdebruijnI'd like to restart rsyslog after a certain point13:05
pmjdebruijnis there a clean way to do this, except creating a new upstart job which does the restart13:05
jhuntwhy do you want to restart rsyslog and what point are you referring to?13:08
pmjdebruijnjust an event13:10
pmjdebruijnit's a special setup13:11
pmjdebruijnnot a normal hosts, it's ramdisk which determines it's hostname by reverse dns lookup13:11
pmjdebruijnso initially it's hostname is just localhost13:11
pmjdebruijna job called nethostname set the proper hostname13:11
pmjdebruijnbut rsyslog is already running then13:11
pmjdebruijnso I need to restart it after nethostname has run13:12
pmjdebruijnfor the time being a job called 'restart rsyslog' seems to way to go13:13
jhuntif you don't want to delay the start of rsyslog (probably not), your proposal should work fine.13:14
pmjdebruijnI though about that, but delaying rsyslog would probably mean losing messages, or possibly other hard to predict issues13:19
pmjdebruijnrestarting at a later point seems the safer choice13:19
pmjdebruijnour rsyslog server already uses %FROMHOST% instead of %HOSTNAME% to make sure the localhost messages go into their proper files13:19
pmjdebruijnusing DynaFile13:19

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!