/srv/irclogs.ubuntu.com/2010/07/31/#upstart.txt

KjetilKI got a bit further with my problem yesterday, but I could use a hand in translating this init.d-script to an upstart job: http://dolot.kipdola.com/wiki/Install_SASC-NG#Init_script (BTW, if anyone is in doubt, what I'm doing is legal here)18:12
KjetilKthere is the runsasc script, which I suppose I could just exec18:18
KjetilK(the runsasc script is elsewhere on the same page)18:19
KjetilKthere is a lot of additional complexity in there though, with timeouts and stuff, that is quite magical to me, and also I don't know if its needed under upstart, and also if there are better ways to deal with the insertion of the dvbloopback kernel module18:21
ionIs the module related to hardware? If yes, udev should autoload it. If not, it could be loaded with modprobe in a pre-start script.18:24
ionSomething like this should work for starters:18:25
ionexec runsasc  # no forking here18:25
ionpost-start script18:25
ion  until [ -e /tmp/SASC_COMPLETE ] ...18:26
ion  (if timeout occurred) exit 118:26
ionend script18:26
ionBased on that, Upstart should handle the stopping when needed.18:27
ionRemember to rm -f /tmp/SASC_COMPLETE in pre-start script.18:27
KjetilKion, ok, nice!18:27
KjetilKthe module is only loosely related to hardware, in that it sets up a loopback device for a video stream that comes from hardware18:29
KjetilKso, I guess pre-start is better18:29
KjetilKhmmm, loading the driver is a large part of what runsasc does18:30
KjetilKperhaps I should try to do everything in the upstart job18:30
KjetilKhmmm, or perhaps not...18:32
ionInstead of the polling for the file, it might be better to use e.g. inotify. Incidentally, i wrote <http://github.com/ion1/wait-for-file> a couple of years ago, but that doesn’t support a timeout. OTOH, is the timeout really necessary?18:40
ionIf runsasc fails, won’t it just return with a non-zero exit value?18:40
KjetilKI have no idea why they are using the timeout, this is too magic for me...18:47
KjetilKhmmm, it seems runsasc kills itself if it fails...18:47
KjetilKhmmm, perhaps I should try to write a minimal upstart job first, not looking too much at what runsasc does18:49
KjetilKand if that doesn't work, go from there...18:49
KjetilKrunsasc has a lot of sleeps, is that a workaround for not having a proper event-based startup system?18:56
KjetilKi.e., something that could be done better with upstart?18:56
ionIf it does any amount of preparation and then finally execs a single, independent server, there’s no need to split it. If it runs two independent services, it would be a good idea to create two jobs.19:05
KjetilKAFAICS, it just inserts a module, then starts a single daemon19:06
KjetilKbut it seems to sit around and wait for things to come up19:07
KjetilKlooks like those who wrote this had some problems they solved by doing this, but I don't know...19:07
KjetilKanyway, bbiab, gotta put the kid to bed :-)19:08
* cwillu_at_work drops a hint about how he'd like to be able to run scripts as a user via "user <foo>" :p23:42

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