/srv/irclogs.ubuntu.com/2014/04/09/#upstart.txt

styolxnox: and then yeah, doesn't work on boot00:01
xnoxstyol: i meant make the job file (a.conf) minimal, start with just e.g. "script \n initctl emit prepared \n end script"00:02
xnoxstyol: and log every line somewhere.00:02
styolwill do now00:03
xnoxand bit by bit increase it. check the environment, upstart cleanses the environment, thus no typical variables are available. re-declare them.00:03
xnoxstyol: e.g. $HOME is _not_ set.00:03
styolxnox: that is one thing I came across with b.conf, decided to just provide the otherwise used environment variable as an argument00:04
xnoxinitctl emit prepared FOO=bar00:07
xnoxcan pass variables.00:07
styolxnox: ah right, but the wrapper script being ran by initctl was relying on an environment variable set like so `echo "export AQUA_CONFIG=$CONFIG" >> "/etc/profile.d/aqua.sh"`00:09
styolseems it is indeed not available, so i'll just have to dynamically create the upstart job with the config file specified as part of the command00:10
xnoxstyol: i think it's supported to have .override files. e.g. keep you main job as is, but e.g. have "env FOO=bar \n env FOO" in a.override00:12
styolxnox: crapola, it must be the NAS mounting because that is the bare minimum.. trying without it now, probably will work00:12
styolinteresting! that would be nice00:12
styolwill try that indeed00:12
xnoxstyol: this way you can do e.g. $ start a FOO=different, and FOO will be overriden with value "different" _and_ available inside all stanzas in a, _and_ due to export be part of events emitted from within it.00:13
xnox "env FOO=bar \n export FOO" in a.override (that is)00:13
styolxnox: but without providing the argument it should take on bar?00:14
xnoxcheck man 5 init, to see if .override file is support, env and export keys.00:14
xnoxstyol: correct.00:14
styoldelicieus, will check as soon as it done rebooting00:14
styolalso delicious00:14
styoli no can englishes today00:14
styolxnox: nutty, never reaches the emitted event http://pastie.org/900972100:16
xnoxstyol: try "initctl emit --no-wait prepared"00:17
styolen route00:17
xnox       --no-wait00:17
xnox              Applies to the start, stop, restart and emit commands.00:17
xnox              Normally  initctl  will  wait  for  the  command  to finish before00:17
xnox              returning.00:17
xnox              For the emit  command,  finishing  means  that  all  of  the  jobs00:18
xnox              affected  by the event are running (or have finished for tasks) or00:18
xnox              have been fully stopped.00:18
xnoxthus e.g. if prepared event blocks then your job just gets stuck there.00:18
xnoxe.g. if there is a job "start on prepared and anotherevent" then you are blocked waiting for "anotherevent" which might never happen.00:19
xnoxgood night.00:19
styolxnox: thank you so so so very much00:19
styolit is very much appreciated00:19
styolsleep well <300:19
styolxnox: so, I ended up moving the NAS mounting to /etc/fstab where it probably should be, and then within the upstart script I am using while and sleep to perpetually check for the existence of the expected file, which does seem to be working. Many thanks again.02:12
TrevinhoHey, one question11:54
Trevinhois the dbus service activation (https://lists.ubuntu.com/archives/ubuntu-devel/2010-December/032295.html) still working (also in a session)?11:54
Trevinhoas I can't find a service that seems to use it11:54
xnoxTrevinho: in recent ubuntu that has been disabled, there are plans to get that back, but it's not back in yet.12:02
Trevinhoxnox: mh I se... so a workaround might be to use upstart init something as the exec for that dbus service or that won't work?12:03
xnoxTrevinho: there are plenty of system jobs that start a daemon which happens to export itself on dbus. So yeah - start on started dbus \n exec foobard12:05
xnoxTrevinho: recent upstarts have upstart-dbus-bridge such that events are generated when things appear/disappear from dbus and one can start/stop jobs according to those events. but that's reactive.12:06
Trevinhoxnox: well, the fact is that I want the service to start not on dbus, but on name activation12:10
Trevinhoxnox: so say you can org.foo.bar then the service starts, handled by upstart, so that I can also stop it12:11
xnoxTrevinho: that's not currently handled.12:11
xnoxTrevinho: it used to be, and there are plans to introduce it.12:12
xnoxTrevinho: do it manually =)12:12
Trevinhoxnox: yes, manually... and to do to do that, can I just add into the dbus .service file an exec= string such as initctl start my-service or that won't work?12:12
xnoxTrevinho: you can do that.12:13
Trevinhoxnox: ok12:14
styolHmm.. any ideas why post-stop might be running on `start on runlevel [2345]? There is also `stop on runlevel [06]`, but from what I understand those run levels should be for halt and reboot 17:51
xnoxstyol: post-stop is run as part of the job life-cycle, e.g. after the main process has terminated (because it crashed, exited normally, or the job is being stopped)23:27
xnoxstyol: start on / stop on -> are simply the event trigger that cause changes to the job life-cycle: e.g. do whatever needs to happen to get the job from dormant to running; or from running to dormant again23:27
styolxnox: aha, that would explain it since it is somewhat of a wrapper script. Crapola. That being the case, a normal script definition doesn't work for stops which is what post-stop was supposed to solve since it calls the same wrapper script called to start23:28
xnoxstyol: post-stop is always executed when the job is stopped, irregardless as to /why/ the job is stopping.23:28
styoltotally makes sense23:28
styol*since it calls the same wrapper script to stop that was used to start23:29
xnoxstyol: you may be need / want "post-start" and "post-stop" scripts.23:29
xnoxstyol: and read the cookbook to see which states the job go through (normal and task jobs) and which snippets of the job are executed when.23:30
styolxnox: gotcha, post-start won't apply to the stop cycle which makes it work like desired, correct?23:31
styolstart is indeed script end script and therein lies the problem that post-start should solve.. awesome idea23:32

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