[00:08] Hey all, upstart newb here trying to debug running Java [00:09] Try that again, sorry. Basically, I'm running this : script [00:09] exec /home/hub/hub/bin/start-MSR.sh [00:09] end script [00:10] But it doesn't seem to kick-off the script. I'm not using nohup for the java process. [00:10] This is on 12.04, so upstart 1.5 [00:11] pre-start and post-start work just fine [00:11] (doing a simple "touch" to make sure it executes) [00:49] Figured it out. We made it too hard. Removing shell control crap fixed ti. [11:15] xnox: hi, would something like this cause lightdm to wait for the service to complete? http://paste.ubuntu.com/7004530/ [11:18] or would it just make sure that the job starts before lightdm without blocking the latter? [11:23] xnox: ok, it seems to block the latter: http://manpages.ubuntu.com/manpages/trusty/en/man7/starting.7.html === marcoceppi_ is now known as marcoceppi === SpamapS_ is now known as SpamapS [19:59] if 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? [20:00] we're having an issue where we have a lot of daemons that are used to run a php file that polls an external API [20:00] we used to run the script using wget [20:00] but recently we switched to running the script using php itself [20:01] and since then, it seems as though the daemons are just dying, but initctl list says theyre still running [20:02] http://privatepaste.com/5ff87c1bdb [20:08] gx: upstart will track the first exec, thus the first exec of php. [20:09] gx: can you change exec to "exec bash -c /var/www/ok_market_history.sh" ? [20:10] i can, what does that do exactly? [20:10] gx: what you should achieve is for: status ok_market_history, to give you the pid of your top-level bash. process. [20:10] ahh [20:10] so instead of only tracking the first php pid [20:10] that will track the bash process, and at the very least tell me when it fails? [20:11] gx: it adds an extra exec, such that the chain is: bash -> bash -> (loop; exec php) [20:11] gx: and upstart should then track the (middle) bash, which should be your shell script. [20:11] gx: correct. [20:12] thanks, i'll give it a shot [20:12] as far as the daemon failing [20:12] i apologize for not understanding it well enough at this point- but is there some kind of error log? [20:27] xnox: should we be using "expect daemon" and "respawn" stances to run the above posted script as a service daemon [20:27] before exec [20:27] ? [20:28] relisys: no, not really. [20:29] ok, tks [20:29] i guess i'm just trying to figure out why the daemon would be "failing" or stopping on its own, at all [20:29] relisys: check the pids thought, "status" should match what you see in "ps" and it should track your bash script. [20:29] when we were doing wget instead of php -f, none of the daemons ever quit on their own, as far as i can remember [20:30] unless relisys begs to differ [20:30] i don't remember it happening prior to that [20:30] this has strictly been happening since we started executing the php files directly as opposed to wgetting the url [20:30] thats why i'm a little confused [20:30] relisys: gx: it all looks weird. you are best to have job just calling the php command. [20:31] relisys: gx: and have a cron job to do "start foo" every 20seconds. [20:31] hmm [20:31] relisys: gx: that way you only have one instance at the time, every 20seconds. [20:31] well we have it built into the script to detect if it's running or not [20:31] relisys: gx: if that php command runs.... and eventually exits. that your job should declare "task" stanza. [20:31] if the script is active, it just exits [20:32] relisys: gx: see upstart cookbook. [20:32] gx: if you have it built into the script, why bother with an upstart job?! [20:32] gx: it looks like you only need cron to kick it off || true, every 20seconds. [20:32] well for a few reasons [20:32] we used to have it that way [20:33] #1 thats what everyone ive spoken with who's knowledgeable on the subject said we should do [20:33] #2 we're able to better monitor everything with daemons, or so we were told [20:33] #3 it's easier to start/stop using daemons as opposed to editing crontab, i guess. [20:33] feel free to argue any of those points [20:33] i'm still learning [20:34] ohh right [20:34] and a big #0 - crons only have resolution of 1 minute [20:34] we alos wanted it to run right away again [20:35] yeah [20:35] xnox seems to have implied otherwise tho... [20:35] as opposed to running the script multiple times within a php loop, which would cause a whole other headache of problems [20:35] but regardless we had 0 problems with the way we were doing it, when we were calling wget [20:36] so i'm trying to understand why executing php directly would all of a sudden cause tehse issues [20:36] and as far as i can tell, the only benefit we gained is less apache2 processes used [20:38] gx: apart from you don't have a daemon. you have a one-shot task, which you want to be periodic. [20:39] right, it's not something that's opening a socket and listening or anything like that [20:39] it's a php script that pulls from an api, normalizes some data, and inserts into db [20:39] but we want it to run every 20 seconds [20:40] and 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 instance [21:23] gx: so, three cron jobs exec every minute: sleep 1 && yourscript. sleep 21 && yourscript. sleep 41 && yourscript. [21:29] xnox 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 php [21:29] im more after that information than anything, for my own understanding [21:29] but yeah it's sounding like we might want to go back to cron jobs [21:31] gx: 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] gx: and main-job is just straing exec to php, with task stanza. [21:31] gx: and without any bash shell wrapper. [21:32] gx: this way you have the 20s trigger/controller job, which starts at most one worker. === SpamapS_ is now known as SpamapS