/srv/irclogs.ubuntu.com/2013/08/18/#upstart.txt

axisysion: thanks00:06
axisysstart foo says already running, status foo says killed and pid is 123400:34
axisyshow do I clean it up and try with expect daemon?00:34
axisysexec foo.pl start within script .. end script00:35
axisysion: start on started mysql did the trick .. now need to fix the actual job :-)00:36
axisysstop on shutdown probably broke it00:38
ionaxisys: https://github.com/ion1/workaround-upstart-snafu01:15
axisysion: sweet.. I will give that a try03:22
axisysreboot starts the job (perl script) fine, but status shows different process id and stop jobname hangs03:32
axisyshttp://pastie.org/private/vequdcuhb0ojvykrerjzha03:32
axisysI guess I should try expect fork instead of expect daemon03:33
ionFigure 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:37
axisysegrep "\<(fork|clone)\>\(" /tmp/strace.log | wc | awk '{print $1}'03:48
axisys1703:48
axisysall are clone, grep fork gets none03:49
axisysok, let me try the alternate method03:54
axisysalternate 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 again04:03
axisyscore part 04:05
axisysexec start-stop-daemon --start --exec /opt/rt4/local/plugins/RT-Extension-Nginx/sbin/rt-nginx-control start04:05
ionWhy 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:13
axisysion: 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 log04:23
axisysion: my orig paste04:24
axisysion: http://pastie.org/private/vequdcuhb0ojvykrerjzha04:24
ionGet rid of “expect daemon” and make rt-nginx-control refrain from daemonizing.04:26
ionYou can remove “script…end script” if all you’re doing is an exec.04:26
axisysremoved the expect and removed the script..end script and just the exec there now04:28
axisys# status rt-nginx-control 04:28
axisysrt-nginx-control stop/waiting04:28
axisysps -ef | grep nginx showing it started though04:29
axisyshttps://github.com/bestpractical/rt-extension-nginx does not say how to start in foreground04:31
axisysactual script04:33
axisyshttps://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control04:33
axisysessentially this gets called 04:37
axisys/usr/sbin/nginx -c /opt/rt4/var/nginx/nginx.conf04:37
axisysand I get my prompt back right away if I run the above04:38
axisysso I guess nginx starts in daemon mode04:38
axisyslooks like nginx requires a expect fork ?04:42
axisyshttp://wiki.nginx.org/Upstart04:42
ionOr preferably don’t make it daemonize.04:43
ion“if [ $? -ne 0 ]; then exit $?; fi” is very weird.04:44
axisysion: i did not use that part.. but otherwise /usr/sbin/nginx -c /opt/rt4/var/nginx/nginx.conf worked .04:47
axisysPID matches and start/status/stop worked04:47
axisyshttp://pastie.org/private/yelt8scmp5rieu2stjkw8g works04:48
axisyshow to not fork with nginx.. still searching04:48
axisyshttps://gist.github.com/serepo/3006274 doing expect fork too04:49
axisysion: found it.. https://gist.github.com/sickill/249252304:49
axisysion: will try that04:49
axisysthat worked perfect too04:57
axisysback to the board05:10
axisys/usr/sbin/nginx -c /opt/rt4/var/nginx/nginx.conf only does half the work of 05:11
axisyshttps://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control05:11
axisysrt-nginx-control start calls start_nginx and start_fcgi05:11
axisysstart_fcgi has the --daemonize in line 120 of 05:12
axisyshttps://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control05:12
axisysI guess I could have two jobs05:12
axisysrt-nginx-control start nginx as one and rt-nginx-control start fcgi as the other05:13
axisysfcgi needs to start before nginx 05:13
spopeim 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:17
axisysion: something wrong with that script.. it does not take start nginx05:20
axisysor start fcgi05:20
axisysonly start05:20
ionspope: Try using su.05:24
ionaxisys: What happens when you try that?05:24
spopeion: but im using setuid to set the user05:25
ionspope: Try using su instead. exec su -s /bin/sh -c 'exec "$0" "$@" user -- command05:29
spopedid you mean to only use one '05:33
spopewhat is the -- command part?05:34
ionSorry, 'exec "$0" "$@"'05:34
ionThe command is whichever command you want to run.05:34
ionSee the cookbook.05:36
axisysion: it display the man page05:36
axisysas if I did not use an argument05:37
axisysion: same behavior05:37
ionWhat exactly did you run and what was the output?05:37
spopeit seems to get stuck05:40
spope exec su -s /bin/sh -c 'exec "$0" "$@"' meteorapp -- forever --sourceDir $APPLICATION_DIRECTORY -a -l $LOG --minUptime 5000 --spinSleepTime 2000 start $APPLICATION_START05:40
spopejust sits there05:41
axisysion: ran /opt/rt4/local/plugins/RT-Extension-Nginx/sbin/rt-nginx-control start nginx 05:45
axisysion: output was ...05:45
axisysion: https://github.com/bestpractical/rt-extension-nginx/blob/master/README05:45
axisysexactly that05:45
axisysnawp05:46
axisysperldoc https://github.com/bestpractical/rt-extension-nginx/blob/master/sbin/rt-nginx-control 05:46
axisysoutput ^05:46
axisysmay be logic is wrong on line 55 of that file05:47
axisysif ( !$command || !$commands{ $command } || ($target && !$target) ) 05:47
axisysanyways.. I were able to find the commands.. I am testing them05:47
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-server05:48
axisysthis the fcgi part ^05:48
axisyslooks like that did it05:52
axisysi can control both upstart 05:52
axisysi can control both with two separate upstart 05:53
axisysjob*05:53
axisyswish I could disable a upstart job with a switch on precise.. instead of doing though echo manual05:56
axisysits fine.. it will do05:56
spopeion: it might also be good if I mention the forever script, calls another05:56
axisyswell.. spoke too fast06:10
axisysif I dont start plackup in daemon mode I am getting bad gateway on the web06:11
axisysyep 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 trick06:16
axisysso I cannot make rt-nginx-control start work from upstart yet06:17
reynirWith a non-graphical session, is there an event that gets triggered when the session starts?10:06
reynirI found out: 'startup'10:13
wrouesnelis there a way to have upstart send mail when the respawn limit is reached?10:35
axisyshow to use a job name in LSB header?18:25
axisyscan I do # Required-Start:    $network $remote_fs $local_fs mysql ?18:26
axisysmysql is a jobname 18:26
axisysi want to start rt-nginx-control sysv init script, but after mysql starts18:27
axisysstarting rt-nginx-control from upstart would be right direction.. but did not work18:35
axisysright now, workaround is adding sleep 5 on the rt-nginx-control does the job19:06

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