I'm tunneling from our web server to our MySQL server, both on Solaris boxes. I've created a SMF manifest for the ssh tunnel in order to reconnect when the web server box reboots. This works great.
The problem is I'm not sure what to do when the MySQL box reboots. This external closure of the tunnel is passed to SMF, which tries to restart the tunnel in rapid-fire succession 3 times before putting the service into maintenance mode. Is there a way to specify a "retry-every" or something similar? Is there another way I should approach the problem?
Here's the SMF I'm using.
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='ssh-tunnel'>
<service
name="network/ssh-tunnel"
type="service"
version="1">
<create_default_instance enabled="false"/>
<single_instance />
<dependency
name='nameservice'
type='service'
grouping='require_all'
restart_on='none'>
<service_fmri value='svc:/milestone/name-services' />
</dependency>
<exec_method
type='method'
name='start'
exec='/usr/bin/ssh -fNx -L 3307:127.0.0.1:3306 mysql1'
timeout_seconds='0'>
</exec_method>
<exec_method
type='method'
name='stop'
exec=':kill'
timeout_seconds='0'>
</exec_method>
</service>
</service_bundle>