SSH with -N and -f in an upstart job

Jamon Camisso jamon.camisso-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Tue Mar 20 02:27:26 UTC 2012


On 12-03-19 10:21 PM, Ted wrote:
> On 03/19/2012 10:13 PM, Jamon Camisso wrote:
>> I'm attempting to use upstart to start up a bunch of ssh port forwarding
>> mappings so that I can check Munin over SSH only (Munin 2.0 has this
>> functionality but isn't ready yet).
>>
>> So far, if I create a simple bash script with a series of commands like
>> the following, I can run munin server locally and have it poll the
>> remote munin-nodes no problem.
>>
>> sudo -u munin ssh muninuser at node1 -L 5001:127.0.0.1:4949 -N -f
>> sudo -u munin ssh muninuser at node2 -L 5002:127.0.0.1:4949 -N -f
>> sudo -u munin ssh muninuser at node3 -L 5003:127.0.0.1:4949 -N -f
>>
>> The problem is that if I put these into exec statements in an upstart
>> job, only the first one executes, the other two do not.
>>
>> I've also tried calling a bash script containing the commands, but
>> upstart just hangs in that case.
>>
>> Anyone here who has written upstart jobs that might be able to point me
>> in the right direction?
>>
>> I'm trying to use upstart instead of an init.d script or rc.local
>> because it seems like a reasonably clean way to run processes like this
>> on startup.
>
> You sure its running? or is it prompting for password that you don't >
see because its run from a different user?

Absolutely - SSH keys, fingerprints, and authorized_keys files are in
place and work. Like I said, calling the exact same commands manually or
in a bash script is fine.

Upstart just seems to stop with the first successful port forwarding
attempt, which makes me think it may not be suited to serially executing
commands.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list