/srv/irclogs.ubuntu.com/2013/12/03/#upstart.txt

mikedevitai have an upstart script which for some reason isnt sourcing env variables that i have defined in /home/root/.bashrc03:57
mikedevitaenv variables like passwords and such for a nodejs app03:57
=== JanC_ is now known as JanC
dsimonhey all; is there a convenient way to keep instanced jobs persisted?18:24
dsimone.g. suppose i have a job foo that has a line "instance $BAR"18:24
dsimonand i do "start foo BAR=a" and also "start foo BAR=b"18:24
dsimon5 minutes later, my UPS fails for a bit and the system shuts down hard18:25
dsimoni'd like those specific instances to be restarted when the system comes back up18:25
xnoxdsimon: have a job" task\n script\n start foo BAR=a; start foo BAR=b\n end script" with appropriate start-on conditions.18:32
xnoxdsimon: that way on each boot those instances are started. (or otherwise arrange for events to happen to bring those jobs up)18:33
xnoxdsimon: there is no persistence across reboots, apart from what's encoded in the job config files.18:33
dsimonxnox, yeah, i just saw that same suggestion from a stack overflow answer, makes sense to me :-)18:33
xnoxdsimon: your other option however is for the instance job to write it's own config file out on disk ;-)18:33
dsimonoh geez, that makes my brain hurt just thinking about it18:33
dsimon"when i start, create a thing that starts me"18:34
dsimonhm... actually, now that i say that, though18:34
dsimonmaybe that's not a terrible idea18:34
xnoxdsimon: "echo '@reboot root initctl --system start BAR=$BAR' > /etc/cron.d/custom-foo-$INST"18:35
xnoxdsimon: but make sure you clean up that same file as well, one the instance gracefully stops and no longer needed, e.g. in post-stop.18:36
dsimonhm, in cron?18:36
dsimonshouldn't i use upstart itself instead?18:36
xnoxdsimon: that's another option. It's best to write out upstart job though.18:36
xnoxdsimon: or write a template and parse / write it out.18:36
dsimonyah18:37
dsimonwell, maybe my best bet is to just have a manager18:37
xnoxdsimon: because that way you get the "start on" conditions right =)18:37
dsimonmy situation is: i have daemons that implement web services which are available on particular ports during particular scheduled date ranges18:37
dsimonso maybe i should just implement a thing that checks the running services list vs. the list of services that should be running given the current date, and starts/stops instances as necessary18:38
dsimonand have cron run it once a minute18:39
dsimonxnox, does that seem like a good idea to you?18:42
xnoxdsimon: yes.18:50
xnoxdsimon: i'm a freak so I would have used nagios for this encode the policy when the service must be up, and give nagios agents to execute start/stop commands to bring them up/down.18:51
xnoxdsimon: cause it has recovery options, such that when the time is right nagios start them.18:51
dsimonhm, that could work18:52
xnoxdsimon: there is a long term plan to implement temporal events, such that one would can do "start on midnight" "stop on 1am"18:52
xnoxor somesuch, but there is no working implementation yet.18:52
dsimonah, i see18:53
dsimonok, cool; xnox, thanks for your help :-)18:55
xnoxno problem =)18:57
dsimonhm20:43
dsimoni just ran into a weird issue20:43
dsimoni had a misconfigured upstart config for nginx20:44
dsimonso it was starting stuff up badly20:44
dsimoni corrected it...20:44
dsimonbut things still did not work :-(20:44
dsimonboth "start" and "stop" would hang, regardless of the expect stanza setting20:44
dsimon... oh, wait20:45
dsimonwait wait20:45
dsimoni bet it was the pid file20:45
dsimonwell, possibly20:47
dsimonat any rate; after restarting the machine, everything seemed to be behaving correctly20:48
dsimonso that makes me happy and sad :-|20:48
dsimonhappy because it works, but sad because i am not sure what happened, or how to prevent it from happening again20:48
dsimonthe reason i mention pid files is because "status" would falsely report an old pid for nginx, even if it was stopped20:49
dsimonokay, now it's happening again; i was starting and stopping nginx just fine, but when i tried "restart", it hung20:51
dsimonand now, start and stop also hang, and start fails to actually start any processes20:52
dsimonwhat could be causing this?20:52
xnoxdsimon: please read the cookbook on "establishing the pid count" and the states it could force your job into.22:03
xnoxdsimon: at the moment, if the expect stanza is wrong, one can get into a "deadlock" you described about (job stuck, cannot reset state)22:04
xnoxdsimon: this is in-progress being fixed (merge proposal under review into trunk)22:04
JanCwell, you can "reset" it with some tricks  ;)22:05
xnoxJanC: yes, yes you can. I've heard of them........ but in no way, i'll suggest that for anyone to do =)))))22:28
JanCwell, they are fine to solve temporary issues22:30
JanCcertainly beats rebooting between tries to get a job right  :p22:30
xnoxtrue =)22:32
xnoxJanC: anyway it's getting fixed properly =)22:32
JanCthat would be nice22:32
JanCxnox: any ETA?22:33
xnoxJanC: as I said there is a merge proposal under review for trunk.22:34
xnoxJanC: it should make it into Trusty (14.04 LTS)22:34
JanCthat's more or less what I meant  :)22:35
JanCa merge proposal is not merged yet, and trunk is not released yet22:35
JanC(and I haven't followed the ML in ages)22:36
xnoxJanC: i've been misquoted on ETAs in the past =))))) i'm trying to be careful.22:40
JanCwell, the E in ETA is for "estimated", so I don't take them as a promise  :)22:41
xnoxack =)22:42
xnoxI still have nightmares from time to time, from the times when i was in "consulting"22:42
JanCugh22:42
xnoxi'm in a happy place now =)22:43
JanCI get nightmares from consultants  ;)22:43
JanCbut there are some exceptions, of course22:43
xnoxhaha =)22:44
JanCI've seen some very competent ones, and many, many who know less than an average helpdesk person with a high school diploma  :-/22:45
JanC(and when I say helpdesk, I mean a real helpdesk, not a bunch of people answering phones with the goal to end calls within less than 1 min 32 sec on average--and one sec less next month, to improve productivity)22:50

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