/srv/irclogs.ubuntu.com/2014/02/27/#upstart.txt

mreynolds__Hey all, upstart newb here trying to debug running Java00:08
mreynoldsTry that again, sorry.  Basically, I'm running this : script00:09
mreynolds  exec /home/hub/hub/bin/start-MSR.sh00:09
mreynoldsend script00:09
mreynoldsBut it doesn't seem to kick-off the script.  I'm not using nohup for the java process.00:10
mreynoldsThis is on 12.04, so upstart 1.500:10
mreynoldspre-start and post-start work just fine00:11
mreynolds(doing a simple "touch" to make sure it executes)00:11
mreynoldsFigured it out.  We made it too hard.  Removing shell control crap fixed ti.00:49
tseliotxnox: hi, would something like this cause lightdm to wait for the service to complete? http://paste.ubuntu.com/7004530/11:15
tseliotor would it just make sure that the job starts before lightdm without blocking the latter?11:18
tseliotxnox: ok, it seems to block the latter: http://manpages.ubuntu.com/manpages/trusty/en/man7/starting.7.html11:23
=== marcoceppi_ is now known as marcoceppi
=== SpamapS_ is now known as SpamapS
gxif you were to run an exec script inside an upstart daemon without an expect stanza, could that result in the process being abandoned and not run even though it says it is start/running still?19:59
gxwe're having an issue where we have a lot of daemons that are used to run a php file that polls an external API20:00
gxwe used to run the script using wget20:00
gxbut recently we switched to running the script using php itself20:00
gxand since then, it seems as though the daemons are just dying, but initctl list says theyre still running20:01
gxhttp://privatepaste.com/5ff87c1bdb20:02
xnoxgx: upstart will track the first exec, thus the first exec of php.20:08
xnoxgx: can you change exec to "exec bash -c /var/www/ok_market_history.sh" ?20:09
gxi can, what does that do exactly?20:10
xnoxgx: what you should achieve is for: status ok_market_history, to give you the pid of your top-level bash. process.20:10
gxahh20:10
gxso instead of only tracking the first php pid20:10
gxthat will track the bash process, and at the very least tell me when it fails?20:10
xnoxgx: it adds an extra exec, such that the chain is: bash -> bash -> (loop; exec php)20:11
xnoxgx: and upstart should then track the (middle) bash, which should be your shell script.20:11
xnoxgx: correct.20:11
gxthanks, i'll give it a shot20:12
gxas far as the daemon failing20:12
gxi apologize for not understanding it well enough at this point- but is there some kind of error log?20:12
relisysxnox: should we be using "expect daemon" and "respawn" stances to run the above posted script as a service daemon20:27
relisysbefore exec20:27
relisys?20:27
xnoxrelisys: no, not really.20:28
relisysok, tks20:29
gxi guess i'm just trying to figure out why the daemon would be "failing" or stopping on its own, at all20:29
xnoxrelisys: check the pids thought, "status" should match what you see in "ps" and it should track your bash script.20:29
gxwhen we were doing wget instead of php -f, none of the daemons ever quit on their own, as far as i can remember20:29
gxunless relisys begs to differ20:30
relisysi don't remember it happening prior to that20:30
gxthis has strictly been happening since we started executing the php files directly as opposed to wgetting the url20:30
gxthats why i'm a little confused20:30
xnoxrelisys: gx: it all looks weird. you are best to have job just calling the php command.20:30
xnoxrelisys: gx: and have a cron job to do "start foo" every 20seconds.20:31
gxhmm20:31
xnoxrelisys: gx: that way you only have one instance at the time, every 20seconds.20:31
gxwell we have it built into the script to detect if it's running or not20:31
xnoxrelisys: gx: if that php command runs.... and eventually exits. that your job should declare "task" stanza.20:31
gxif the script is active, it just exits20:31
xnoxrelisys: gx: see upstart cookbook.20:32
xnoxgx: if you have it built into the script, why bother with an upstart job?!20:32
xnoxgx: it looks like you only need cron to kick it off || true, every 20seconds.20:32
gxwell for a few reasons20:32
relisyswe used to have it that way20:32
gx#1 thats what everyone ive spoken with who's knowledgeable on the subject said we should do20:33
gx#2 we're able to better monitor everything with daemons, or so we were told20:33
gx#3 it's easier to start/stop using daemons as opposed to editing crontab, i guess.20:33
gxfeel free to argue any of those points20:33
gxi'm still learning20:33
gxohh right20:34
gxand a big #0 - crons only have resolution of 1 minute20:34
relisyswe alos wanted it to run right away again20:34
relisysyeah20:35
relisysxnox seems to have implied otherwise tho...20:35
gxas opposed to running the script multiple times within a php loop, which would cause a whole other headache of problems20:35
gxbut regardless we had 0 problems with the way we were doing it, when we were calling wget20:35
gxso i'm trying to understand why executing php directly would all of a sudden cause tehse issues20:36
gxand as far as i can tell, the only benefit we gained is less apache2 processes used20:36
xnoxgx: apart from you don't have a daemon. you have a one-shot task, which you want to be periodic.20:38
gxright, it's not something that's opening a socket and listening or anything like that20:39
gxit's a php script that pulls from an api, normalizes some data, and inserts into db20:39
gxbut we want it to run every 20 seconds20:39
gxand we have it built in so that if by chance it takes > 20 seconds, it detects that it's actively running, and quits, and will be run at the next free instance20:40
xnoxgx: so, three cron jobs exec every minute: sleep 1 && yourscript.   sleep 21 && yourscript. sleep 41 && yourscript.21:23
gxxnox i understand we can do that, and we just might- but it still doesnt help me understand why the daemon would be quitting in the first place, after switching from wget to php21:29
gxim more after that information than anything, for my own understanding21:29
gxbut yeah it's sounding like we might want to go back to cron jobs21:29
xnoxgx: you can do it with two upstart jobs. First job, has script stanza and does the while loop, each time it does "initctl start --no-wait main-job".21:31
xnoxgx: and main-job is just straing exec to php, with task stanza.21:31
xnoxgx: and without any bash shell wrapper.21:31
xnoxgx: this way you have the 20s trigger/controller job, which starts at most one worker.21:32
=== SpamapS_ is now known as SpamapS

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