/srv/irclogs.ubuntu.com/2010/06/11/#upstart.txt

OmahnWhat's the correct way to abort startup of an upstart job in the pre-start script?10:29
OmahnAh, possibly just 'exit 1' ?10:30
OmahnSeems to work. :-)10:32
ionThat’s okay for an error. For a graceful abort, run ‘stop’.10:49
Omahnion: I was just going to ask about that. So, for a misconfiguration in the setup of a given daemon, detected during pre-start, I should use exit 1. If the daemon is simply disabled in the daemon, I should use 'stop' and that will prevent the 'exec' from firing. Is that correct?10:51
Omahn*disabled in the configuration, that should say10:51
ionYep10:52
Omahnion: Great, thanks.10:52
ionAlso note that the scripts are run with -e. In some cases, exit 1 may be redundant since the shell would exit with a non-zero value anyway.10:52
OmahnNoted, thanks.10:53
yarihmhi everybody14:46
yarihmI'm currently trying to get a fedora 13 container working in openvz. I'm new to upstart but if I got that correctly, the jobs are defined under /etc/init/<name>.conf in a pretty straight forward way. From what I can tell (initctl list) openvz starts init properly but that in turn is only able to start one of the jobs (the one that spawns mingetty), the others are listed as 'stop/waiting'. When I try to start the stopped job14:55
yarihms I get 'initctl: Job failed to start' with no place to start debugging.14:55
Omahnyarihm: From my limited knowledge, it's probably something in one of your script sections exiting with non-zero. Maybe try increasing the log level of upstart with 'initctl log-priority debug' and then watching the log files. (/var/log/daemon on ubuntu, not sure on Fedora)15:00
yarihmOmahn, actually I tried that, too :) Let me try again, but I think initctl fails to log anything even though I started the syslog daemon15:01
yarihmLet me give it another shot15:01
yarihmok, it doesn't log much actually, but I tried it with a test-job and that seems to be working15:05
yarihmI wrote a task with a pre-start script that touches a file in /tmp and a script that touches a different file in /tmp. when starting that job, initctl outputs15:09
yarihm[root@backend99 init]# initctl start test215:09
yarihmtest2 stop/waiting15:09
yarihmif I add something that doesn't detach (top) in the script, it fails. Is the expectation that the started daemon/binary detaches or not?15:09
yarihmalso: there's no logging anywhere about why this procedure fails15:10
iontop probably just dies immediately due to there not being a terminal.15:10
yarihmah15:10
yarihmI see some logging in /var/log/messages BTW15:11
ionTask jobs aren’t for daemons, service jobs are.15:11
yarihmUh, i see some issue here anyway, the mingetty-task seems to respawn because it tries to attach to the wrong device node15:12
iongettys should be services, not tasks.15:13
yarihmwhat are tasks for then?15:14
ionTask is something you expect to run once and then end when started. Service is something you expect to keep running indefinitely when started.15:14
yarihmI removed the getty thing now, it's not needed in a openvz-container anyway AFAICT15:15
ionE.g. a job that runs sysctl -p on startup would be a task, since it should happen once and be done. Gettys are more like daemons, so they should be services. They should additionally respawn, so you get a new getty when you log out from a session.15:17
yarihmmhm, makes sense15:18
yarihmI copied an openvz-task from an ubuntu template (trying to get fedora core 13 running), that has this section here:15:19
yarihmtask15:19
yarihmpre-start script15:19
yarihm#mount -t devpts devpts /dev/pts15:19
yarihm#mount -t proc proc /proc15:19
yarihmif [ ! -e /etc/mtab ]; then15:19
yarihm        cat /proc/mounts > /etc/mtab15:19
yarihmfi15:19
yarihmend script15:19
yarihmhowever, when trying to start that openvz task, I get15:19
yarihminit: openvz pre-start process (82) terminated with status 3215:19
yarihm... how can that be? /etc/mtab actually evaluates to true15:20
yarihmI mean [ -e /etc/mtab ] does15:20
ionJust after the pre-start script line, add:15:20
ion  exec >/dev/something.log 2>&115:21
ion  set -x15:21
yarihmyou mean exec >/tmp/something.log I guess?15:21
ion/dev is a safe assumption of something writable, /tmp might not be. If you know /tmp is writable, sure.15:22
yarihmah, ok :)15:22
yarihmwell, it seems that the if statement just evaluates to 32 ... whatever, I added 'true' before end script so this works now. Now it's the main-script that fails, I'll try to debug that15:24
ionCurious. I don’t see how the if statement could return 32.15:25
yarihmyeah, me neither15:27
yarihmis the script running as if it were 'set -e'?15:27
yarihmin other words, does it terminate with the first command that returns non-zero? maybe the mount commands return 32 (but they are commented out)15:28
ionYes, -e is on by default.15:28
ionThe only things i can see failing are cat opening /proc/mounts for reading and the shell opening /etc/mtab for writing.15:30
yarihmwell, actually since the file /etc/mtab exists that should never be an issue15:36
yarihmcu guys l8er16:08
=== JanC_ is now known as JanC

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