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 |
---|---|---|
AnrDaemon | aquarius_: I'm not sure it's a good idea to build something like that. What if it drops because host moved? | 11:19 |
AnrDaemon | How would you manage repetitive respawns in transition process? | 11:19 |
AnrDaemon | If I were you, I'd write a wrapper app to manage respawn of autossh. | 11:20 |
AnrDaemon | And 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 away | 11:46 |
aquarius_ | I do see your point though. | 11:47 |
AnrDaemon | That'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 $HOST | 11: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 | ||
AnrDaemon | aquarius_: If you want to go that route, you can just make second job an instance. | 14:57 |
AnrDaemon | But 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 instances | 15:00 |
AnrDaemon | Instance is a job that can be started multiple times, each identified by a key. | 15:00 |
AnrDaemon | So, say, you make it "instance $HOST" and start one instance per host. http://upstart.ubuntu.com/cookbook/#instance | 15:01 |
aquarius_ | ah, I get it, I think. Cheers | 15:28 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!