/srv/irclogs.ubuntu.com/2012/12/07/#upstart.txt

stgraberand success! Had to do quite a few more changes in nih-dbus-tool to get it to generate the right code and still have its tests pass, but it looks good now and my upstart branch builds and passes its tests!00:03
ryanfis it normal behavior for upstart to assume your process has died if you send it a USR1 signal?04:38
ryanfand if so, how can I tell it not to assume that?04:38
ryanfideally I'd like to be able to send that signal to a process that upstart is watching without upstart itself noticing or caring04:38
ryanfit won't result in the process terminating04:38
SpamapSryanf: no it won't assume your process has died on USR105:01
SpamapSryanf: upstart is ptracing looking for an exit of some kind.05:01
SpamapSryanf: or if you havn't used 'expect fork' then it is just waitpid() on the process, which will only return if the process exits.05:02
ryanfSpamapS: that's really weird then05:08
ryanfSpamapS: what I'm getting is stuff like05:08
ryanf[170555.273477] init: sidekiq (0) main process (29388) killed by USR1 signal05:08
ryanfin the syslog05:08
ryanfand then it's marked as stopped05:08
ryanfbut I can see with ps that the process is still running05:08
ryanf(I am not using expect fork btw)05:10
SpamapSryanf: thats really odd, that message is only printed when libnih claims the child process was killed or core dumped05:11
ryanflet me double-check that05:15
ryanfoh, I see! in reality I am an idiot05:15
SpamapSryanf: the process does exit doesn't it?05:16
ryanfyes. the twist is that there are two processes05:16
ryanfinitctl lists the pid for start-stop-daemon05:16
ryanfand I was assuming that was the pid for the process started by start-stop-daemon05:16
SpamapSwaitid() will only return that state if the process is literally *killed* by that signal05:16
ryanfso I was sending USR1 to start-stop-daemon, thereby killing it05:16
stgraberexpect fork instead of expect daemon?05:16
SpamapSryanf: you may not be calling start-stop-daemon right then. It should be exec'ing your process, not staying around and forking05:17
stgraberthough having an upstart job use start-stop-daemon sounds pretty weird, considering upstart is doing pretty much everything start-stop-daemon was designed to do :)05:17
ryanfapparently it's the recommended way to create a pidfile for the process05:17
ryanfalthough come to think of it, I don't need the pidfile anymore, so maybe I should just stop using it05:18
stgraberright, you don't need a pidfile as long as upstart can figure out what your final pid is and track it05:18
SpamapSryanf: why are you making a pidfile?05:20
SpamapSugh, lag05:20
SpamapSas I'm hitting enter my IRC client catches up from 2 minutes ago05:20
ryanfI needed one before because I was trying to integrate with the tools that come with this software05:20
ryanfwhich want a pidfile05:20
ryanfbut as soon as I get my own script doing the USR1 thing correctly, I have no reason to use those tools05:20
ryanfback to using a pidfile, because otherwise I don't have a way to get the pid to send USR1 to it -- semi-long story05:32
ryanfthanks a lot for pointing out my false assumptions about what was going on before though05:32
ryanfgot it working completely now. thanks again.05:41
jodhxnox: your changes to https://wiki.ubuntu.com/FoundationsTeam/Specs/RaringUpstartUserSessions#Configuration_Files_for_User_Jobs are still ambiguous. Now that you've removed the table, it is not clear what happens if an override file exists earlier in the search path *and* in the current search directory. So if /etc/xdg/upstart/foo.override, ~/.config/upstart/foo.override and ~/.config/upstart/foo.conf exist, which .override applies? Can10:48
jodhyou clarify this in the spec please.10:48
xnoxjodh: The first one only applies.10:49
jodhxnox: also, the table would have helped a lot with writing the tests for this part of the feature I think as we need full coverage :)10:49
xnoxjodh: ok, I will.10:49
xnoxjodh: not really, cause by default there are 3 "system dirs" and 2 "user dirs"10:49
xnoxjodh: and none of them have anything special about them. It's just a priority ordered list of conf sources.10:50
jodhxnox: I'm not saying we need to test every possible combination of those 5 directories, but we need representative tests that cover atleast 2 directories with .conf and .override in each to prove the behaviour.10:50
xnoxack.10:51
xnoxjodh: I thought the test needs 3 directories and do a matrix test of all possible combinations of foo.conf & foo.override existance across all three directories.10:58
xnoxIt is a little overkill, but guarantees coverage.10:58
xnoxjodh: updated the spec again. Please re-check for ambiguity.11:03
jodhxnox: works for me. Your update LGTM.11:16
xnoxthanks.11:17
jodhxnox: I think all these on-list discussions are slowly drawing out some of the implicit assumptions we've all had up to now :)11:17
xnox=))))) yeah, the "OMG, but I thought it will do this instead" is not we want =)11:24
jodhxnox: right ;D11:26
xnoxjodh: well. I now think to not change --confdir behaviour. And even in the Session Upstart to continue the same --confdir semantics (specify N times and only the Nth will be loaded)11:36
xnoxjodh: while system init has conf_sources which is a NihList, the session init only has a string conf_path.13:18
xnoxDoes this imply that while system init supports on api level multiple conf sources, the session init doesn't?13:19
xnoxOr am I misinterpreting system init & it actually also does not support multiple conf sources?13:19
=== soren_ is now known as soren
stgraberjodh: hey there. Do you think you'll have time to look at my libnih merge proposal today?14:35
stgraberjodh: and thanks for the comment on the prctl branch, I'll try to add some autoconf magic around that block14:35
jodhstgraber: probably not I'm afraid - currently in the middle of putting a release together.14:44
jodhstgraber: thanks.14:44
xnoxjodh: does that mean that I should clean up the autopkg merge?!14:50
jodhxnox: I'm only doing an upstream release today, but if you want to get the DEP-8 bits ready for Monday that'd be great.14:51
xnoxjodh: ok. I am writting XDG config dir parser for upstart now & I have installer bug to look into. Hopefully, all will be done by Monday.14:52
jodhxnox: cool14:53
=== carif_ is now known as carif
ajptrying to make my new script run on upstart, im new to upstart, where should I start?22:40
JanCajp: probably the cookbook, see /topic22:44
JanChttp://upstart.ubuntu.com/cookbook/22:44
JanCand of course the manpages  ;)22:45
ajpinstead of using upstart, is it wise to add my script to @reboot in crontab? 22:57
xnoxajp: no. because you can't stop/restart/respawn @reboot entries.22:58
xnoxajp: or let users/admins temporary override some options in the job with an override file.22:58
ajpxnox: it's a script that monitors a folder for new files, compresses and moves them. I'm the only user. I just need the script to start at boot22:58
xnoxajp: I recommend you to create a logrotate snippet in /etc/logrotate.d/22:59
ajpnot sure what that is22:59
xnoxajp: logrotate is a daemon that does: monitoring of files or logs, re-compresses them and keeps archived copies for a defined period of time.23:00
ajpI have the script done and it works, i just want it to run at boot so i dont have to launch it every time23:01
xnoxajp: e.g. it's the daemon that creates, keeps and cleans up all the /var/log/*.gz files.23:01
ajpthe files im "compressing" are PDFs and it uses ghostscript to make them smaller, not actually compressing them23:01
xnoxah, I see.23:01
ajp:D23:02
xnoxajp: @reboot should be fine, an upstart job as well.23:02
ajpboth23:02
ajp?23:02
ajpor just 123:02
* xnox thinks with enough twiddling you can ask logrotate to use a custom "recompressor" command and use logrotate facilities for the rest.23:02
ajpi'm thinking the @reboot sounds much easier to accomplish23:02
xnoxajp: just one of the above is enough =)23:03
ajpxnox: thanks man, imma try the @reboot and see23:03
ajpso i tried the @reboot, didnt work23:13
ajplooks like imma learn upstart23:13
ajpxnox: do I only have to modify one file to add it to upstart?23:13
xnoxyes.23:14
ajp/etc/init?23:14
ajpxnox: which file am i editing?23:15
ajpxnox: sorry if im pestering23:15
xnox/etc/init.d/my-cool-recompressor.conf23:17
xnoxbah.23:17
xnoxwrong.23:17
xnox/etc/init/my-cool-recompressor.conf23:17
ajpok i created the file23:18
ajpbut i named it MontiorScannedPDFs.conf23:18
ajpxnox: how does this look? http://pastebin.com/DVhstVqa23:25
xnoxajp: remove stop on, change start on to be23:27
xnox"start on filesystem"23:27
xnox(no need for explicit stop, as your job will be killed on shutdown anyway)23:27
ajpok23:28
ajpso is this ready to go now23:28
ajp?23:28
xnoxyeah.23:28
ajpcool, im gunna try it. brb23:28
ajpso I start it by typing$ service MonitorScannedPDFs start   ???23:31
ajpor should i just reboot23:31
xnoxeither should work.23:31
ajpwhen i did the first one it says: http://pastebin.com/DVhstVqa23:31
ajpoops23:32
ajpstart: Rejected send message, 1 matched rules; type="method_call", sender=":1.3" (uid=1000 pid=1696 comm="start MonitorScannedPDFs ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")23:32
xnoxsudo ?23:32
ajpi did23:32
ajpwait i didnt23:32
ajplol23:32
ajpbut now it says: start: Rejected send message, 1 matched rules; type="method_call", sender=":1.3" (uid=1000 pid=1696 comm="start MonitorScannedPDFs ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")23:33
ajpsry23:33
ajpstart: Job failed to start23:33
ajpxnox: this is what I have now: http://pastebin.com/zUjJ9G8c23:34
ajpdo I need the . in front of the script path?23:34
ajpoh wait, fixed it. I had to add sudo in front of script path23:35
ajpnow for testing23:36
xnoxajp: you can use setuid23:36
ajpexplain23:36
xnoxajp: http://upstart.ubuntu.com/cookbook/#setuid23:36
xnoxto run as your username.23:36
ajpoic23:37
ajpits running but the script isnt doing its job23:39
ajpalthough when i run the script by itself it works23:39
ajpnot sure what's wrong here23:39

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