/srv/irclogs.ubuntu.com/2011/02/02/#upstart.txt

twbIs "pre-start exec" allowed (instead of "pre-start script")?03:37
twbAlso: WTF just happened: stop gitit ==> stop: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist03:38
JanCtwb: yes03:38
JanCan no clue about the DBus error  ;)03:39
JanCand *03:39
twbOK, thanks03:39
twbI think it was pissed because I said "script end" instead of "end script"03:39
twbhttp://paste.debian.net/106276/03:41
twbThough strangely, it isn't writing anything to the logfile now I rotated it03:41
JanChm, how does it log?03:43
twbnot via syslog(3)03:43
twbI think it opens it directly03:43
twbhttp://paste.debian.net/106277/03:45
twbThis is on lucid, btw03:45
JanChm, and with savelog -p the permissions should be right too, I suppose03:46
twbHmm, even if I run gitit as root, it doesn't write to that file03:47
twbStrace can see it opening the log, though03:48
twbopen("/var/log/gitit.log", O_WRONLY|O_CREAT|O_NOCTTY|O_APPEND|O_NONBLOCK, 0666) = 703:48
JanCis it supposed to write anything in absence of errors?03:49
twbAh, I think the original 271 bytes were logs of *init*03:50
twbi.e. subsequent boots don't print anything, even for GETs03:50
twbI give up.03:57
twbBTW, do you know how to not have the extra su process hanging around?03:57
twbhttp://paste.debian.net/106278/03:57
JanCyes, but not sure if upstart will like that  ;)04:19
twbTell me and I'll check04:20
twbAlso re logging, it was because 'log-level: WARNING' is the default.04:20
JanCbasically, su is waiting for the process it starts to end04:22
twbWhy doesn't it do a forkless exec of sh -c?04:23
twbI'd use sudo instead, but I'd prefer to avoid the syslog noise from sudo04:31
JanCyou can run gitit in the background04:46
JanCbut upstart might not like that  ;)04:47
twbYeah, obviously that's no good04:47
JanCI doubt the su process does any harm to your system anyway  ;)04:50
twbSure, it's just ugly04:50
anchepiecehi all, does anyone know where the upstart/initctl status is saved? like the association between the daemon and the pid.  i have a incorrectly stopped init that is now giving the 'start/killed' with a non-existant pid15:47
anchepiecei was hoping to clear the config somewhere15:47
JanCit's "saved" in memory only16:08
JanChttp://heh.fi/tmp/workaround-upstart-snafu might be useful 16:15
SpamapSanchepiece: just stop the job .. 16:31
SpamapSOh I see.. can't kill the pid that doesn't exist. Interesting.16:33
SpamapSJanC: where did that workaround-upstart-snafu script come from btw?16:44
JanCSpamapS: ion pointed to it a couple of days ago16:45
SpamapSSeems like init would know about any pids it was tracking dying.16:49
JanC_grrr, why does my ISP insist on 36-hourly disconnects...  :-(16:51
JanC_SpamapS: ion pointed to it a couple of days ago16:51
JanC_I guess it's his script16:51
=== JanC_ is now known as JanC
JanCmaybe it was tracking the wrong pid though?16:52
anchepieceSpamapS: i cant find that script online anymore18:29
anchepiecehave a copy18:29
anchepiece?18:29
JanCanchepiece: if you mean the snafu script, it's still there?18:32
anchepiecethe url is 40418:32
JanCnot from here...18:33
JanCyou in some place where internet is filtered?18:33
anchepieceah its back!18:33
anchepiecethanks18:33
anchepiecewell it just spawns infinit threads18:37
SpamapSJanC: my point is that even if it was tracking the wrong pid.. if the pid it is tracking dies.. it will know and respawn or not .. 18:37
anchepiecei think ill wait till a reboot and leave the renamed daemon 18:37
SpamapSanchepiece: so status foo shows a pid that doesn't exist?18:38
SpamapSanchepiece: or status foo shows infinite pids ?18:38
JanCSpamapS: it won't (always) respawn infinitely though18:38
anchepiecestatus foo shows a pid that doesdnt exist18:38
SpamapSJanC: right, I'm more saying that I can't see a situation where upstart shows a pid that is dead in status.18:38
anchepiecethe workaround-snafu prints out an increasing number (new pids?)18:39
SpamapSseems like a bug somewhere.18:39
SpamapSthat workaround-snafu may take forever on a system that uses pseudo random pids.18:39
JanCI've never seen it happen myself18:39
anchepiecethe bug was my fault (putting an expect fork when there shouldnt have been, then prematurely ctrl-c killing the stop command when it stalled)18:39
anchepieceno it increments18:40
JanCSpamapS: yeah, in theory it can as well take 100 years or something  ;)18:40
anchepieceie: start/killed, process 13790 ./workaround-upstart-snafu 13790  prints out the next pid available past 13790 like 22xxx then counts up as it creates new pids18:41
SpamapSinteresting18:41
anchepiecegoing to leave it running just to see what happens18:41
anchepieceok it dropped back to 1000s18:42
anchepiecenow i understand how it works18:42
JanCit tries until a process with that PID exists18:43
JanCthen we hope upstart gets unconfused  ;)18:43
anchepieceit did, but it respawned the old conf18:44
JanCit's normally used for a slightly different issue though18:44
anchepiecenowe stop is hung 18:44
anchepiecei think this tool will work18:47
JanCupstart needs a built-in "unbreak" command I guess  ;)18:47
anchepiecewell maybe a non-ruby dependant version of the script will do18:47
JanCthat should be easy enough18:47
JanCit just forks until a process has the requested PID18:48
SpamapSJanC: the issue is that upstart can only do anything if a process's parent pid is 1.. it does that by either keeping it in the foreground, or ptrace attaching.. so somewhere, it detached from the process without making sure it was dead. That seems to be the bug.18:49
anchepieceit worked -> status: Unknown job:18:50
anchepiecethanks for help18:50
SpamapSanchepiece: glad its resolved for you.. but thats pretty ugly.. forking through the whole pid namespace. :-P18:51
SpamapSerr.. pid space..18:51
JanCSpamapS: that's why it's called a workaround  ;)18:52
anchepieceand now respawning on a crash is working perfectly18:52
anchepiecei vote to add that script or a bash variant to the release package 18:53
JanCfixing the bug would be better  ;)18:54
anchepiecea long-term state of stopped/killed with a pid may be a clue18:54
JanCa command to tell upstart it has to forget or force the status of 1 particular job could be useful too18:55
JanCbut of course that's still a workaround18:55
SpamapSYeah18:56
SpamapSbetter workaround18:56
SpamapSIt actually may be this bug https://bugs.launchpad.net/upstart/+bug/53917518:56
SpamapSbut.. in reverse18:56
anchepiecehttps://bugs.launchpad.net/ubuntu/+source/upstart/+bug/438313    https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/504989   https://bugs.launchpad.net/upstart/+bug/406397  18:59
SpamapSanchepiece: thanks.. that does look like the problem19:03
ionThe real fix is the proc connector implementation that Just Works™. Meanwhile, people just need to use ‘expect’ only when they’re 100 % sure of the forking behavior of their main process.19:18
SpamapSgiven the response tho19:22
SpamapSthe existence of a "verify pids" workaround seems needed19:22
SpamapSalso it would make sense for init to just verify that its signal was acted on by checking the entry in /proc if available19:23
ionBackups are needed for people who delete important stuff by mistake. Yes, people shouldn’t delete important stuff by mistake.19:24
ionAnyhoo, a clean patch that is not too nasty a kluge might make it into Upstart.19:25
ion…if Keybuk approves it, of course. :-)19:33
Keybukwhat do I have to approve?19:39
ionPeople have been suggesting that Upstart check the pids it thinks it’s tracking actually exist as a workaround when people confuse Upstart with incorrect use of ‘expect’. That is, until the proc connector implementation is there, of course. I said your approval is needed for a patch if someone feels like creating one.19:52
Keybukhow would it "check" the pid?20:00
ionIn any case, it would be a kluge. I didn’t really give thought to how to avoid a race condition etc.20:02
Keybukreminds me that I must finish my new supervisor code, give that to everyone to play with20:14
ionThe proc connector code?20:19
yuantaiHello! I hope I'm in the right channel. I have a question on upstart. I have a daemon to monitor the power status. It needs to intercept shutdown/reboot event, i.e. runlevel 0 and 6, and before network goes down, it needs to report to a centralized server. My question is: in upstart how to I define "before network goes down and after shutdown/reboot"?21:04
yuantaiOr can someone point me to the right place/mailing list to ask the question? Thanks!21:20
anchepieceyuantai: i think if you stick around a bit someone will have a good answer for you.. 21:24
anchepiecei think yuo can throw a script into here though: /etc/network/if-down.d21:24
anchepiece/etc/network/if-down.d/upstart i mean21:24
yuantaithank you anchepiece,21:29
yuantaiI'm doing it on a RHEL6 machine, it doesn't have the /etc/network/if-down.d/upstart. Is it only in Ubuntu? 21:31
anchepiecehttp://upstart.pastebin.com/vz8hq55721:33
SpamapSyuantai: how about start on starting rc RUNLEVEL=[016]   ?21:33
anchepiecethats the initctl emit21:33
* SpamapS doesn't know if RHEL6 uses rc either :-P21:34
anchepiecethat file is in marked executabe in /etc/network/if-down.d/ dir21:34
yuantaiThanks SpamapS, it seems RHEL6 also uses rc.21:39
SpamapSyuantai: note that that will make it run *before* the shutdown commences21:39
SpamapSyuantai: but, as soon as your job finishes, the rc will start and shutdown21:39
yuantaianchepiece: I'm wondering if I can use this code in my own machine? 21:41
anchepiecein a conf file add a "start on net-device-down"21:43
yuantaiSpamapS: in this combined format, can I find out which runlevel the admin issued? My daemon also needs to know whether it's reboot or shutdown21:43
yuantaianchepiece: for "start on net-device-down", is it going to run when ifdown command is issued?21:46
anchepieceyou need to drop that script in /etc/network/if-down.d/ ,which will emit and read in your conf21:47
anchepieceso yes21:47
SpamapSyuantai: yes $RUNLEVEL will be set to it I think21:47
anchepiecei guess that ubuntu is much more tightly integrate with upstart than fedora/redhat21:47
SpamapSanchepiece: I don't know if they have that in fedora/redhat21:48
anchepiece/etc/network/if-down.d/ ?21:48
anchepieceoh hrm21:48
anchepieceyes you're right21:48
anchepiecewell, on this older fedora c7 its not there21:49
anchepiecebut i see mention of it in fc1321:50
anchepiecei guess look thtough /etc/sysconfig/network-scripts21:51
yuantaithanks anchepiece, yes it's in /etc/sysconfig/network-scripts, 21:52
yuantaiBut is this folder the upstart scripts?21:55
anchepiecei think you'd have to add a call yourself to the /etc/sysconfig/network-scripts/ifdown script (see how OTHERSCRIPT is run, duplicate that)21:56
anchepiecesorry have to go but you are close21:56
yuantaithank you anchepiece21:56

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