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