/srv/irclogs.ubuntu.com/2012/09/12/#upstart.txt

j4m3shelloooooo #upstart - n00b here02:28
j4m3si have two erlang processes i want to create upstart scripts for, and they require a few other services to be running (haproxy and rabbitmq)02:30
j4m3swhat's the better approach to this? creating events in rabbitmq that trigger the erlang processes to start   -or-   checking to see if the rabbitmq process is running?02:32
SpamapSj4m3s: better is to not assume those services are on the local box06:17
SpamapSj4m3s: start everything in parallel, make sure they poll/retry for services that they need.06:18
SpamapSj4m3s: that will make your services more robust and easier to scale out.06:19
chris|hi14:53
chris|I was wondering, is there a way to have the `kill timeout` stanza accept a variable that needs to be sourced from a defaults file?14:54
SpamapSchris|: no not really16:38
SpamapSchris|: you could put it into a .override file if you're worried about changing the packaged .conf tho16:38
j4m3sSpamapS, so polling for services would be more robust than waiting for an event?16:45
chris|SpamapS, not, that's not really the issue, thanks though16:52
SpamapSj4m3s: yes, because you can't wait for an event that happens on a different server17:03
SpamapSchris|: one of the ideas behind upstart is to be able to parse everything in one directory right at boot time. shelling out to source a default file is just more wasted boot time when you could put the value in the .conf file and have it parsed already17:04
j4m3sbut you can poll for a process on another server? do you happen to know of a good example?17:04
SpamapSj4m3s: you'd be polling for its network service17:04
SpamapSj4m3s: apache can be started up before mysql, and still use mod_auth_mysql17:05
chris|SpamapS, sure, but whenever you are porting from debian or still might need SysinitV support for some reason, it's always desirable to not maintain multiple configurations17:08
SpamapSchris|: Indeed, if you *must* keep the /etc/init.d script alive on the same host, then the /etc/default/* file would be good17:10
SpamapSchris|: but that seems like a rare occasion... what service needs both the upstart job and the local init.d ?17:11
kgrahamhello, using fedora/amazon linux and need to know how i would run a job before the network stops18:38
kgrahamie 'the first thing run on shutdown/reboot'18:38
SpamapSkgraham: start on deconfiguring-networking18:39
SpamapSkgraham: thats on Ubuntu 11.10 and later18:39
SpamapSkgraham: for fedora/amzn.. not sure.. maybe 'start on starting rc RUNLEVEL=[06]'18:39
kgrahamok thanks!18:40
kgrahami'll try that18:40
j4m3sSpamapS, so am i correct in saying, pid's are unnecessary with upstart?18:53
SpamapSj4m3s: pidfiles are usually not necessary, though there are still cases where they are needed when a program does weird stuff that makes it hard for upstart to track it18:54
j4m3sSpamapS, if i have a start on stopped job, if that job respawns does the other job also restart?18:57
j4m3serr lemme rephrase a lil more clearly, if i have a script for myapp, and it starts on stopped job foo, will myapp restart whenever foo respawns?18:59
SpamapSj4m3s: start on and stop on just change the "goal state" for a job. If its already 'start' , start on does nothing.19:02
j4m3sSpamapS, ok thanks19:04
j4m3sso i have a job that i've started with upstart and when i do initctl status foo it says foo is stopped/waiting22:38
j4m3s*stop/waiting22:38
SpamapSj4m3s: indeed, if the main process exits, and you don't have 'respawn' specified, thats the normal behavior22:39
j4m3si have respawn specified22:39
j4m3sthe process is running 22:39
j4m3sbut upstart is having trouble tracking it i suppose22:39
SpamapSj4m3s: did it exit 0? if it exits with a 0 return code and no signal killing it, then that is also considered a normal exit, not somethign to respawn for22:39
SpamapSj4m3s: ah, so it daemonizes, but you haven't specified expect fork/daemon ?22:40
j4m3scorrect22:40
SpamapSj4m3s: two options. 1: use expect fork/daemon, or tell the program not to daemonize22:40
SpamapSI prefer the latter22:40
pulzi have been testing upstart with some daemons latly, and in most cases upstart will report OK running, even if the process is killed 22:42
pulzany reason for this behavoiur ?22:42
j4m3sSpamapS, it appears rabbitmq-server created a bash wrapper that calls the erlang bins but doesn't exit22:45
j4m3sSpamapS, and the job i'm creating is for a erlang process22:45
SpamapSj4m3s: the only problem with the bash wrapper approach is that HUP, TERM, and KILL signals will be sent to the bash process. You want it to exec something that stays running/attached23:00
j4m3sSpamapS, so i circumvented the bash script and called erl from the upstart script, but it still daemonizes and exits cleanly23:04
j4m3sSpamapS, wait nvm my changes got wiped23:04

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