/srv/irclogs.ubuntu.com/2016/08/31/#upstart.txt

aquarius_I have a "two stage" process; first, I make a curl request to a URL which returns me a hostname, and then I ssh to that hostname with autossh. I'd like to have upstart manage this process so that if autossh dies it gets respawned, but I don't want it to run the curl again if it gets respawned; just restart autossh. How am I best to do that with upstart?09:26
AnrDaemonaquarius_: I'm not sure it's a good idea to build something like that. What if it drops because host moved?11:19
AnrDaemonHow would you manage repetitive respawns in transition process?11:19
AnrDaemonIf I were you, I'd write a wrapper app to manage respawn of autossh.11:20
AnrDaemonAnd set up that as the job.11:20
aquarius_AnrDaemon: I thought about that, but I don't think I can tell the difference between "it dropped because there was a network wobble" and "it dropped because the host is gone", but I want to reconnect on wobbles and do a new curl request if the host goes away11:46
aquarius_I do see your point though.11:47
AnrDaemonThat's up to your wrapper to solve. Ping the host, if not available, lookup and ping again, for example.11:47
aquarius_on the actual upstart point, what I've done is have two jobs; one is start on network-up and does the curl, then emits start-the-ssh HOST=somehost, and the second is start on start-the-ssh; stop on network-down; respawn; exec autossh $HOST11:48
aquarius_can I tell from inside a job if I was respawned by upstart?11:48
aquarius_what I'm trying to avoid is writing my own tiny service monitor to deal with autossh dying, because upstart's good at that and I'm not :)11:51
aquarius_Second upstart question. Does upstart fire an event when one connects to or disconnects from a wireless access point? I can put a script in /etc/NetworkManager/dispatcher.d to do that and fire a custom event, of course, but it'd be nice to stay within upstart.12:01
=== JanC is now known as Guest73215
=== JanC_ is now known as JanC
AnrDaemonaquarius_: If you want to go that route, you can just make second job an instance.14:57
AnrDaemonBut you'll need to have first job start on stopped XXX.14:58
aquarius_AnrDaemon: can you explain that in a bit more detail? I don't think I really understand instances15:00
AnrDaemonInstance is a job that can be started multiple times, each identified by a key.15:00
AnrDaemonSo, say, you make it "instance $HOST" and start one instance per host. http://upstart.ubuntu.com/cookbook/#instance15:01
aquarius_ah, I get it, I think. Cheers15:28

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