custom job to be prioritised against system jobs - Take 2

Luigi Capriotti l.capriotti at tiscali.it
Wed Mar 7 13:55:24 UTC 2012


Having found examples of wait-jobs I gave it a try but still no success.

My custom jobs are something like:

# myjob
start on (starting lightdm or starting ubiquity)
task

script
	# blablabla

end script


#Myjob-wait
start on (starting lightdm or starting ubiquity)
stop on (started myjob or stopped myjob)

instance $JOB
normal exit 2
task

script
     status myjob | grep -q "start/running" && exit 0
     start myjob || true
     while sleep 3600 ; do :; done
end script


but at runtime I can see that ubiquity runs while my job is still not 
completed.

This is the related part of the syslog:



Mar  7 15:34:40 live kernel: [   23.113578] init: ubiquity state changed 
from waiting to starting
Mar  7 15:34:40 live kernel: [   23.114356] init: 
event_pending_handle_jobs: New instance myjob-wait (lightdm)
Mar  7 15:34:40 live kernel: [   23.114390] init: myjob-wait (lightdm) 
goal changed from stop to start
Mar  7 15:34:40 live kernel: [   23.114577] init: myjob-wait (lightdm) 
state changed from waiting to starting
Mar  7 15:34:40 live kernel: [   23.115111] init: 
event_pending_handle_jobs: New instance myjob
Mar  7 15:34:40 live kernel: [   23.115143] init: myjob goal changed 
from stop to start
Mar  7 15:34:40 live kernel: [   23.115324] init: myjob state changed 
from waiting to starting
Mar  7 15:34:40 live kernel: [   23.161755] init: 
event_pending_handle_jobs: New instance myjob-wfullait (ubiquity)
Mar  7 15:34:40 live kernel: [   23.161936] init: myjob-wait (ubiquity) 
goal changed from stop to start
Mar  7 15:34:40 live kernel: [   23.162370] init: myjob-wait (ubiquity) 
state changed from waiting to starting
Mar  7 15:34:40 live kernel: [   23.163723] init: 
event_pending_handle_jobs: New instance myjob
Mar  7 15:34:40 live kernel: [   23.163965] init: myjob-wait (lightdm) 
state changed from starting to pre-start
Mar  7 15:34:40 live kernel: [   23.165725] init: myjob-wait (lightdm) 
state changed from pre-start to spawned
Mar  7 15:34:40 live kernel: [   23.168202] init: myjob-wait (lightdm) 
main process (2777)
Mar  7 15:34:40 live kernel: [   23.168277] init: myjob-wait (lightdm) 
state changed from spawned to post-start
Mar  7 15:34:40 live kernel: [   23.168998] init: myjob-wait (lightdm) 
state changed from post-start to running
Mar  7 15:34:40 live kernel: [   23.169648] init: myjob state changed 
from starting to pre-start
Mar  7 15:34:40 live kernel: [   23.170685] init: myjob state changed 
from pre-start to spawned
Mar  7 15:34:40 live kernel: [   23.172333] init: myjob main process (2779)
Mar  7 15:34:40 live kernel: [   23.172398] init: myjob state changed 
from spawned to post-start
Mar  7 15:34:40 live kernel: [   23.173278] init: myjob state changed 
from post-start to running
Mar  7 15:34:40 live kernel: [   23.174364] init: myjob-wait (ubiquity) 
state changed from starting to pre-start
Mar  7 15:34:40 live kernel: [   23.177147] init: myjob-wait (ubiquity) 
state changed from pre-start to spawned
Mar  7 15:34:40 live kernel: [   23.180389] init: myjob-wait (ubiquity) 
main process (2783)
Mar  7 15:34:40 live kernel: [   23.180466] init: myjob-wait (ubiquity) 
state changed from spawned to post-start
Mar  7 15:34:40 live kernel: [   23.184515] init: myjob-wait (ubiquity) 
state changed from post-start to running
Mar  7 15:34:40 live kernel: [   23.185392] init: myjob-wait (lightdm) 
goal changed from start to stop
Mar  7 15:34:40 live kernel: [   23.185915] init: myjob-wait (lightdm) 
state changed from running to pre-stop
Mar  7 15:34:40 live kernel: [   23.186111] init: myjob-wait (lightdm) 
state changed from pre-stop to stopping
Mar  7 15:34:40 live kernel: [   23.186348] init: myjob-wait (ubiquity) 
goal changed from start to stop
Mar  7 15:34:40 live kernel: [   23.186534] init: myjob-wait (ubiquity) 
state changed from running to pre-stop
Mar  7 15:34:40 live kernel: [   23.186768] init: myjob-wait (ubiquity) 
state changed from pre-stop to stopping
Mar  7 15:34:40 live kernel: [   23.187393] init: myjob-wait (lightdm) 
state changed from stopping to killed
Mar  7 15:34:40 live kernel: [   23.188682] init: Sending TERM signal to 
myjob-wait (lightdm) main process (2777)
Mar  7 15:34:40 live kernel: [   23.188976] init: myjob-wait (ubiquity) 
state changed from stopping to killed
Mar  7 15:34:40 live kernel: [   23.189942] init: Sending TERM signal to 
myjob-wait (ubiquity) main process (2783)
Mar  7 15:34:40 live kernel: [   23.190131] init: ubiquity state changed 
from starting to pre-start
Mar  7 15:34:40 live kernel: [   23.190351] init: ubiquity state changed 
from pre-start to spawned
Mar  7 15:34:40 live kernel: [   23.194599] init: ubiquity main process 
(2795)
Mar  7 15:34:40 live kernel: [   23.194677] init: ubiquity state changed 
from spawned to post-start
Mar  7 15:34:40 live kernel: [   23.195073] init: ubiquity state changed 
from post-start to running
Mar  7 15:34:40 live kernel: [   23.213354] init: myjob-wait (lightdm) 
main process (2777) killed by TERM signal
Mar  7 15:34:40 live kernel: [   23.213473] init: myjob-wait (lightdm) 
state changed from killed to post-stop
Mar  7 15:34:40 live kernel: [   23.213674] init: myjob-wait (lightdm) 
state changed from post-stop to waiting
Mar  7 15:34:40 live kernel: [   23.214129] init: myjob-wait (ubiquity) 
main process (2783) killed by TERM signal
Mar  7 15:34:40 live kernel: [   23.214206] init: myjob-wait (ubiquity) 
state changed from killed to post-stop
Mar  7 15:34:40 live kernel: [   23.214432] init: myjob-wait (ubiquity) 
state changed from post-stop to waiting
Mar  7 15:34:48 live kernel: [   31.404423] init: myjob main process 
(2779) exited normally
Mar  7 15:34:48 live kernel: [   31.404566] init: myjob goal changed 
from start to stop
Mar  7 15:34:48 live kernel: [   31.404688] init: myjob state changed 
from running to stopping
Mar  7 15:34:48 live kernel: [   31.404964] init: myjob state changed 
from stopping to killed
Mar  7 15:34:48 live kernel: [   31.405038] init: myjob state changed 
from killed to post-stop
Mar  7 15:34:48 live kernel: [   31.405108] init: myjob state changed 
from post-stop to waiting



Again, thanks in advance for any help.

Luigi




More information about the upstart-devel mailing list