[05:06] <mase_wk> hi ppl, is it possible to use upstart to run an application when a file has been modified ?
[14:29] <sadmac2> mase_wk: there's nothing built into upstart to do that
[14:31] <sadmac2> mase_wk: you could have somes sort of inotify daemon tell upstart to run things, but then you could also have it run them directly (depending on your application upstart man be the better choice)
[16:01] <SatanClaus> hey guys, once more I'm trying to update my old init-scripts. this time a script which automatically performs a backup. In the old system I started it in runlevel 0 via link: /etc/rc0.d/S15backup, so after all daemons stopped, but before the partitions are unmounted.
[16:02] <SatanClaus> is there some list of events, which are thrown during shutdown, so I know which event to bind my script to?
[16:03] <sadmac2> SatanClaus: that depends on your distro's setup. You should ask in #yourdistro
[16:04] <SatanClaus> ubuntu 9.10 again... is there some way to log all events cronologically into a file?
[16:06] <sadmac2> SatanClaus: you might make a job that just logs its triggering event to a file and make it "start on *"
[16:06] <sadmac2> ...I think that works
[16:10] <SatanClaus> yupp, thought about that, but 2 problems: 1: how do I assign the calling event (start on *) to a variable, which I could then log? 2: doesn't the start of my job then produce events itself (starting, etc.), which would cause an infinite loop?
[16:11] <sadmac2> SatanClaus: the infinite loop thing is... interesting
[16:11] <sadmac2> SatanClaus: the name of the event is put into the script environment for you
[16:13] <SatanClaus> can't find it in the docs again... how's that variable called then?
[16:13] <SatanClaus> $EVENT ??? ;)
[16:13] <sadmac2> I think its UPSTART_EVENTS
[16:13] <SatanClaus> events?
[16:13] <SatanClaus> so possibly even multiple?
[16:13] <sadmac2> SatanClaus: yes. thanks to the "and" operator your job can actually be triggered by two or more events
[16:17] <ion> Upstart doesn’t really do shutdown in Ubuntu 9.10. The sysvrc scripts still handle it. My suggestion for the next-generation Upstart is that “system running” is a state, and anything that should happen just before shutting down should get triggered by the ‘system pre-stop’ event or equivalent, and the ‘system post-stop’ script would call reboot -f/halt -f.
[16:17] <SatanClaus> ah, true... cause I thought about that one as well... i first wanted to specify "ok, my backup shall be start on stopping mountall and stopping networking", but what if for any reason mountall needs to stop after networking is stopped. wouldn't that cause a lock?
[16:18] <sadmac2> SatanClaus: yes. The and operator is an ugly thing
[16:18] <sadmac2> SatanClaus: generally stay away from it.
[16:22] <SatanClaus> ion: yupp, such an event would be nice
[16:22] <SatanClaus> sadmac2: so upstart doesn't detect deadlocks?
[16:23] <sadmac2> SatanClaus: the theory behind upstart was that deadlocks would be impossible
[16:24] <SatanClaus> ok ;)
[16:24] <SatanClaus> thought i just presented a counter example
[16:24] <ion> The *implementation* is on its way to the goal. :-P
[16:24] <SatanClaus> ;)
[16:25] <SatanClaus> ok, cause an admin should be warned about such things...
[16:25] <sadmac2> SatanClaus: the and operator was... not implemented on one of Keybuk's good days.
[16:25] <SatanClaus> but for this you'd need a simulation run, etc.
[16:25] <ion> We can ditch the and operator in its current form as soon as we get real states into Upstart.
[16:27] <SatanClaus> ok, so as my backup currently runs I'll leave it like it is for now ;) nevertheless one thing: the output of the old sysinitv script is gone, can I get it back somehow?
[16:28] <SatanClaus> (i.e. the script writes output about its progress to stdout, which is gone since upstart)
[16:30] <sadmac2> SatanClaus: that's an Ubuntu issue
[16:31] <sadmac2> SatanClaus: and I think they may tell you NOTABUG when you ask
[16:31] <ion> exec >log 2>&1
[16:31] <SatanClaus> ion: uhm, where should I put that... currently i only have the old sysinitv link in /etc/rc0.d
[16:32] <SatanClaus> so there's no upstart .conf file
[16:32] <SatanClaus> at least not for the backup
[16:33] <sadmac2> SatanClaus: that goes in the top of your sysvrc, and "log" is the name of a logfile
[16:33] <sadmac2> SatanClaus: so he's telling you to go log the output
[16:33] <SatanClaus> uhm, but I want to see it...
[16:33] <SatanClaus> while shutting down
[16:33] <sadmac2> SatanClaus: I believe Ubuntu policy forbids making that easy
[16:34] <SatanClaus> anyhow, I know that tomcat is shown somehow, I'll investigate that ;)
[16:34] <SatanClaus> hmm, i think it's bad style not to tell the user what's going on... so if all old sysinitv scripts are muted by default... ugh
[16:51] <SatanClaus> hmm, i don't understand why other sysinitv scripts can show their output with echo on screen, while my script can't.
[16:52] <SatanClaus> there's no "console output" stanza in /etc/init/rc.conf
[16:52] <SatanClaus> and when I track back the log-calls in /etc/rc0.d/K08tomcat6 then I can find that it uses echo as well
[16:53] <SatanClaus> ok, via a function in /lib/lsb/init-functions, but I don't know how this could matter.
[16:54] <sadmac2> SatanClaus: maybe its piping to somewhere
[16:55] <SatanClaus> thought about that, but couldn't find anything
[16:55] <sadmac2> SatanClaus: use whatever tomcat's using
[16:56] <SatanClaus> i can't, i don't only want to see echo output but also rsync
[16:59] <sadmac2> hm