/srv/irclogs.ubuntu.com/2011/10/18/#upstart.txt

vaxerdecwell anyways who cares.  taking a look around... most of my systems have dozens or even hundreds of days of uptime00:04
vaxerdeci mean that's great for a laptop but you know what i hardly ever reboot that too.  mostly just for kernel updates00:05
vaxerdeci was thinking the same thing... looking at the lsb-init headers... those contain plenty of dependency information.  i never knew init to actually use that data though, found in that header00:06
vaxerdecand now oracle bought ksplice so maybe they'll mainstream it and i'll just never reboot :)00:07
vaxerdeci guess over time after lots of updates you accumulate lots of krufty deleted inodes though still in use... but there's kexec anyways00:09
vaxerdeci actually think upstart is a little overly complicated too but it's quite capable00:13
vaxerdecstill newbie will have really hard time understanding it i think00:14
vaxerdecunlike sysvinit00:14
vaxerdeci mean charts and graphs showing state transition diagrams, a cookbook, wikis, huge man pages...00:15
vaxerdecthe gentoo system actually looks pretty simple00:16
vaxerdeci'll tell you though... it is definitely nice that i can reboot my system in about five seconds after the bios runs... actually less, seems around 3 seconds00:17
vaxerdeci mean my laptop (which is on ssd)00:17
vaxerdec(and i don't run any junk)00:17
vaxerdeci still have problems though with reboot, just hangs when i do shutdown -r now00:18
vaxerdecdoesn't seem to run the rc with 6 as arg00:19
vaxerdeci have to go in another terminal and run /etc/rc.d/rc 6 manually00:26
vaxerdecer, that was /etc/init.conf not /etc/init/init.conf01:42
bradleyayersworkhi05:10
bradleyayersworki have a job that has multiple instances, and another job that starts those instances05:11
bradleyayersworki'd like to be able to emit an event that causes all the instance jobs to restart05:11
bradleyayersworkhttp://dpaste.com/636318/ is my instance job conf05:11
bradleyayersworkthe two important lines are 12 and 1305:11
bradleyayersworki was under the impression that if you have a "stop on" and "start on" stanza that has the same requirement, the "stop on" will be performed first, followed by the 05:12
bradleyayerswork"start on"05:12
bradleyayersworkhowever when i do "initctl emit genocide DOMAIN=foo", it job instance stops, but it does not start05:13
bradleyayersworki presume this is something to with it not having the ${COMMAND} parameter?05:13
bradleyayersworki'm just looking for some help :)05:15
philip__hi! is there a best practice how to handle processes that are not able to fork themselves into background?10:45
philip__when doing "service xyz start", upstart always tells me "xyz start/running, process 12345"... even when the process has an exit status != 010:47
jhuntso, the Upstart job you're trying to start via the SysV interface starts then exits with status != 0? What is "xyz" and what's the .conf file look like?10:54
philip__jhunt: like this: http://pastebin.com/USY8B5nb11:15
philip__jhunt: so exit status 1 and 2 are examples11:15
philip__jhunt: oh and xyz is a Go program, Go unfortunately doesn't support programs that can daemonize themselves :S11:21
philip__(yet)11:21
philip__I can reproduce the same effect with this program: http://pastebin.com/Qfm7Ps9a11:23
jhuntIf these programs are not long-running, you need to use the "task" stanza.11:26
philip__Yes, I've seen that. I mean under normal circumstances the program will run for weeks.11:27
philip__But this scenario might happen: I stop the daemon, a small feature is added to the software or its configuration, and I start the daemon, thinking everything is ok... but it failed right from the start. Or another scenario: the server is rebooted and the server admin forget to check whether all services are running perfectly.11:29
jhuntwell, it sounds like the go program is forking atleast once, but you haven't told upstart how many times ("fork" for 1, or "daemon" for 2). You might want to strace xyz on the command-line and see how many forks it's doing and then update the .conf accordingly.11:30
philip__No it's not... actually I can reproduce the problem with this C-program: int main() { return 1; }11:32
philip__(but yes, upstart manages do daemonize the program nicely, in case everything is ok)11:33
jhuntI am rather confused by what you've said so far. To be clear - you are starting daemon xyz, Upstart says it is running, but you are saying it has actually exited (even though you say it should be long-running)?12:35
jhuntyour main example clearly isn't a daemon so can't be compared with the daemon scenario12:35
philip__jhunt: precisely13:03
philip__jhunt: why not?13:04
philip__jhunt: when you have a daemon that does no forks and that exits right after starting because of an error, this is the same13:04
philip__jhunt: just to be clear: any daemon, even those that fork one or two times, might have a fatal error *before* doing any forking13:05
philip__the point is, my "daemon" is not to throw away the "main()". so there is no forking involved in my scenario13:07
philip__s/is not to/is not able to13:07
philip__though obviously upstart does forking13:08
philip__maybe this mininmal version of my "daemon" (I prefer to call it server, anyway) is less confusing: http://pastebin.com/BtzM92LP13:15
negevhi, is it possible to set dependencies for runlevel 6? ie. i want to execute a script on shutdown/reboot but ensure that rsyslog isn't stopped until the script finishes13:20
jhuntI think your confusion comes from the fact that Upstart *does* successfully start your daemon. At some later date, your daemon decides something went bad and exits. However, you haven't told Upstart to auto-restart it ("respawn"). If admin intervention is required to say fix the daemons broken config, respawn won't help :)13:22
jhuntphilip__: maybe you could use a pre-start to perform some sort of sanity check on the config, print a message and fail.13:22
* jhunt makes mental note to self to update the cookbook on some of these issues.13:23
philip__jhunt: ;)13:24
jhuntnegev: if you're using Ubuntu, you could make your script "start on stopping rsyslog". Since rsyslog stops on shutdown/reboot, your script will run before rsyslog stops (and before the system shuts down/reboots).13:24
jhuntphilip__: I can only think that the machine you're running that http://pastebin.com/Qfm7Ps9a example on is incredibly slow since you wouldn't normally even see a pid if the job immediately exits.13:27
philip__jhunt: yeah, though I wonder whether it's the 3.3Ghz cpu or the 16 Gigs ram... sorry just joking :D13:33
philip__jhunt: but this is interesting, so you say the timing is the problem...13:33
negevcool thanks jhunt 13:34
negevjhunt: that doesn't seem to work; i put this http://pastebin.com/zW2s1F4z in /etc/init/myshutdown.conf13:50
negevits executing the script but the syslog isn't happening, rsyslog must have already stopped when it runs13:50
jhuntnegev: are you sure your script is running successfully to completion? Try running "sh -n /etc/init.d/my-shutdown.sh" and checking that it is really doing what you think.14:00
jhuntnegev: See http://upstart.ubuntu.com/cookbook/#develop-scripts-using-bin-sh14:00
jhuntnegev: and http://upstart.ubuntu.com/cookbook/#debugging-a-script-which-appears-to-be-behaving-oddly14:00
negevwell i put "touch /home/negev/test" at the top of the script and the file is being created so it must be running14:03
jhuntnegev: no - *that* line is running, but subsequent lines might be failing due to Upstart running your script using "sh -e".14:04
negev-e or -n?  -n says it doesn't execute the commands, it just reads them14:05
negevit works if i execute it with -e, fails with -n14:06
jhuntI've suggested -n to ensure your script is syntactically correct (as far as the shell can check without running it).14:06
negevthe script is just one line that executes a ruby script14:06
negevthe bang line is correct and the ruby script is mode 755, ive even tried prefixing it with /usr/bin/ruby14:06
negevshould i maybe just put the ruby script and its argument in the script section of the init config file?14:07
jhuntnegev: any particular reason you're sourcing the script?14:08
jhuntnegev: I was wondering why you weren't :)14:08
negevok well i just did that, still didn't work though :(14:08
negevoh do i need that . before it ?14:08
jhuntIf you're asking, the answer is "no" :)14:09
negevhrmm then why is it still failing :(14:10
negevkind of annoying that this server takes forever to boot14:10
jhunthave you traced it with -x as I suggested above?14:11
negevi can't see -x anywhere in the history :/14:11
jhuntalso, can you not just try "start <yourjob>" (force it to run without waiting for rsyslog to be about to stop).14:11
negevyeah doing that works fine14:12
negevcould it be that the "stopping rsyslog" event never happens and rsyslog is just killed without being gracefully stopped?14:14
jhuntnegev: oops! here it is - http://upstart.ubuntu.com/cookbook/#obtaining-a-log-of-a-script-section14:14
negevall i got in that log was a + before the line that executes the ruby script14:27
negevnothing else at all14:27
jhuntHave you tried "start <yourjob>"?14:29
negevyeah i said, that works fine14:29
negevand its definitely executing when i reboot or shutdown because if i put "touch <file>" at the top it creates the file14:30
negevit just doesn't log anything14:30
jhuntIt's possible /etc/init.d/sendsigs might be killing your ruby process/rsyslog if they are taking "too long" to finish. You could put a temporary sleep in sendsigs to establish that fact.14:31
negevthat seems unlikely given that it runs and finishes instantly if i run it manually14:31
negevall it does is write an entry to the syslog and then exits14:31
jhuntnegev: um, any reason you're using ruby to do that?14:32
negevwe have one script that does loads of things, it seemed sensible to add this to it as we already use it for other stuff which also logs to syslog14:32
negevrather than having multiple scripts14:33
jhuntnegev: what does "status rsyslog" show?14:40
negevrsyslog start/running, process 107114:40
jhuntnot sure what else to suggest without seeing what you're actually running. How about changing shutdown.conf to call 'exec logger -i -t negev "hello"' just to see if syslog is usable at that point.14:44
jhuntnegev: you could also have shutdown.conf run "ps -ef" or something to convince yourself the logger is still running.14:44
jhuntnegev: is it possible your ruby script is making use of some other service which has already stopped when your shutdown job is started?14:45
negevpossible i guess, although i don't think it is14:45
negevi was just looking at simplified syslogging from the cmdline, worth a try14:45
jhuntnegev: also, see if the behaviour you are seeing is consistent across systems.14:46
negevwell these three servers were installed and built identically so probably not much point testing the other two lol14:49
negevi tried putting:   logger -i -t oe "system shutdown"   14:49
negevsorry, exec logger -i -t oe "system shutdown"14:49
negevin the script section14:49
negevdidn't work ;914:49
negev:(14:49
negevwell at least didn't make it to the remote syslogs, need to wait for it to come back up before i can see if it got it locally but i doubt it14:50
negevim convinced rsyslog is already gone by the time this execugtes14:50
negevnope, nothing in the local syslog either14:51
negevinteresting, if i stop rsyslog manually it doesn't execute either14:52
negevsh -n exec logger -i -t oe "system shutdown"    gives:  sh: Can't open exec14:53
jhuntnegev: negev put the commands in a file and run "sh -n file"14:55
negevincluding exec?14:56
jhuntexec is recognized by the shell and by upstart.14:57
negevsh -n <script> returns nothing15:07
jhuntnegev: good news then.15:08
negevwell not really, still no clues as to why this isn't working15:10
SpamapSjhunt: hey, long time no chat. :)15:37
jhuntSpamapS: howdi!15:37
SpamapSjhunt: did we ever sort out the user sessions in 11.10?15:38
SpamapSI know they were somewhat suspect in 11.0415:38
jhuntSpamapS: they are in 11.10 but not enabled by default.15:38
SpamapSstill unstable?15:39
jhuntSpamapS: they are problematic to test but I've now got a test script that's in upstream and Ubuntu, but not packaged for ubuntu as yet.15:39
jhuntSpamapS: well, we could do with more testing but afaik it's pretty solid now.15:39
SpamapSjhunt: ok, was just trying to think up ways they might be made more useful.15:45
jhuntSpamapS: it would be gr8 for user sessions if NetworkManager emitted Upstart events. You could do cool things like start firefox only when you're connected to wifi say.15:55
SpamapSjhunt: net-device-up *is* emitted in that case.15:56
jhuntSure - I was thinking more of being able to filter on ESSID, encryption type, etc. And we should already be able to do things like fire up a user app when say a user plugs in their usb headset using the udev bridge so there are a few use cases already.16:02
rrvahi20:01
rrvaI need to su to another user, start a shell script which sets some env variables and then start a java app20:02
rrvaupstart fails hard in getting the correct PID20:02
rrvai use expect daemon20:02
SpamapSrrva: can you tell the java app to not daemonize?22:53
SpamapSrrva: its far simpler to just run things in the foreground22:53

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