[00:06] ion: thanks [00:34] start foo says already running, status foo says killed and pid is 1234 [00:34] how do I clean it up and try with expect daemon? [00:35] exec foo.pl start within script .. end script [00:36] ion: start on started mysql did the trick .. now need to fix the actual job :-) [00:38] stop on shutdown probably broke it [01:15] axisys: https://github.com/ion1/workaround-upstart-snafu [03:22] ion: sweet.. I will give that a try [03:32] reboot starts the job (perl script) fine, but status shows different process id and stop jobname hangs [03:32] http://pastie.org/private/vequdcuhb0ojvykrerjzha [03:33] I guess I should try expect fork instead of expect daemon [03:37] Figure out what the exact forking behavior of the main program is and *if* one of the expect values matches, use it. Otherwise disable daemonizing altogether. Feel free to skip directly to the latter alternative. [03:48] egrep "\<(fork|clone)\>\(" /tmp/strace.log | wc | awk '{print $1}' [03:48] 17 [03:49] all are clone, grep fork gets none [03:54] ok, let me try the alternate method [04:03] alternate method showing same behavior.. start and status gives wrong PID and then stop hangs with process killed showing wrong PID.. thanks for your workaround-upstart-snafu or I have to reboot again [04:05] core part [04:05] exec start-stop-daemon --start --exec /opt/rt4/local/plugins/RT-Extension-Nginx/sbin/rt-nginx-control start [04:13] Why not: exec /opt/rt4/local/plugins/RT-Extension-Nginx/sbin/rt-nginx-control start? [04:13] (Also, make sure *that* doesn’t daemonize) [04:23] ion: thats how I started and then went with start-stop-daemon alternate [04:23] /opt/rt4/local/plugins/RT-Extension-Nginx/sbin/rt-nginx-control start gives 17 clones per strace log [04:24] ion: my orig paste [04:24] ion: http://pastie.org/private/vequdcuhb0ojvykrerjzha [04:26] Get rid of “expect daemon” and make rt-nginx-control refrain from daemonizing. [04:26] You can remove “script…end script” if all you’re doing is an exec. [04:28] removed the expect and removed the script..end script and just the exec there now [04:28] # status rt-nginx-control [04:28] rt-nginx-control stop/waiting [04:29] ps -ef | grep nginx showing it started though [04:31] https://github.com/bestpractical/rt-extension-nginx does not say how to start in foreground [04:33] actual script [04:33] https://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control [04:37] essentially this gets called [04:37] /usr/sbin/nginx -c /opt/rt4/var/nginx/nginx.conf [04:38] and I get my prompt back right away if I run the above [04:38] so I guess nginx starts in daemon mode [04:42] looks like nginx requires a expect fork ? [04:42] http://wiki.nginx.org/Upstart [04:43] Or preferably don’t make it daemonize. [04:44] “if [ $? -ne 0 ]; then exit $?; fi” is very weird. [04:47] ion: i did not use that part.. but otherwise /usr/sbin/nginx -c /opt/rt4/var/nginx/nginx.conf worked . [04:47] PID matches and start/status/stop worked [04:48] http://pastie.org/private/yelt8scmp5rieu2stjkw8g works [04:48] how to not fork with nginx.. still searching [04:49] https://gist.github.com/serepo/3006274 doing expect fork too [04:49] ion: found it.. https://gist.github.com/sickill/2492523 [04:49] ion: will try that [04:57] that worked perfect too [05:10] back to the board [05:11] /usr/sbin/nginx -c /opt/rt4/var/nginx/nginx.conf only does half the work of [05:11] https://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control [05:11] rt-nginx-control start calls start_nginx and start_fcgi [05:12] start_fcgi has the --daemonize in line 120 of [05:12] https://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control [05:12] I guess I could have two jobs [05:13] rt-nginx-control start nginx as one and rt-nginx-control start fcgi as the other [05:13] fcgi needs to start before nginx [05:17] im using forever to keep a node app running, and using setuid in the upstart script, but forever keeps trying to create the .forever files in /root, any ideas? [05:20] ion: something wrong with that script.. it does not take start nginx [05:20] or start fcgi [05:20] only start [05:24] spope: Try using su. [05:24] axisys: What happens when you try that? [05:25] ion: but im using setuid to set the user [05:29] spope: Try using su instead. exec su -s /bin/sh -c 'exec "$0" "$@" user -- command [05:33] did you mean to only use one ' [05:34] what is the -- command part? [05:34] Sorry, 'exec "$0" "$@"' [05:34] The command is whichever command you want to run. [05:36] See the cookbook. [05:36] ion: it display the man page [05:37] as if I did not use an argument [05:37] ion: same behavior [05:37] What exactly did you run and what was the output? [05:40] it seems to get stuck [05:40] exec su -s /bin/sh -c 'exec "$0" "$@"' meteorapp -- forever --sourceDir $APPLICATION_DIRECTORY -a -l $LOG --minUptime 5000 --spinSleepTime 2000 start $APPLICATION_START [05:41] just sits there [05:45] ion: ran /opt/rt4/local/plugins/RT-Extension-Nginx/sbin/rt-nginx-control start nginx [05:45] ion: output was ... [05:45] ion: https://github.com/bestpractical/rt-extension-nginx/blob/master/README [05:45] exactly that [05:46] nawp [05:46] perldoc https://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control [05:46] output ^ [05:47] may be logic is wrong on line 55 of that file [05:47] if ( !$command || !$commands{ $command } || ($target && !$target) ) [05:47] anyways.. I were able to find the commands.. I am testing them [05:48] /usr/local/bin/plackup --server FCGI --listen /opt/rt4/var/nginx/fcgi.sock --pid /opt/rt4/var/nginx/fcgi.pid --daemonize --nproc 10 --keep-stderr 1 /opt/rt4/sbin/rt-server [05:48] this the fcgi part ^ [05:52] looks like that did it [05:52] i can control both upstart [05:53] i can control both with two separate upstart [05:53] job* [05:56] wish I could disable a upstart job with a switch on precise.. instead of doing though echo manual [05:56] its fine.. it will do [05:56] ion: it might also be good if I mention the forever script, calls another [06:10] well.. spoke too fast [06:11] if I dont start plackup in daemon mode I am getting bad gateway on the web [06:16] yep the only way web app works if I call rt-nginx-control start.. calling plackup and calling nginx in any order does not do the trick [06:17] so I cannot make rt-nginx-control start work from upstart yet [10:06] With a non-graphical session, is there an event that gets triggered when the session starts? [10:13] I found out: 'startup' [10:35] is there a way to have upstart send mail when the respawn limit is reached? [18:25] how to use a job name in LSB header? [18:26] can I do # Required-Start: $network $remote_fs $local_fs mysql ? [18:26] mysql is a jobname [18:27] i want to start rt-nginx-control sysv init script, but after mysql starts [18:35] starting rt-nginx-control from upstart would be right direction.. but did not work [19:06] right now, workaround is adding sleep 5 on the rt-nginx-control does the job