I am using Debian 8 and have configured a script and put it under /etc/init.d directory as below. Basically, I want to open ssh tunnels on startup.
#! /bin/sh # /etc/init.d/open_tunnels ### BEGIN INIT INFO # Provides: open_tunnels # Required-Start: $network $syslog $remote_fs # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO case "$1" in start) echo "Running open_tunnels..." <ssh command> ;; stop) killall open_tunnels ;; *) echo "Usage: /etc/init.d/open_tunnels start" exit 1 ;; esac exit 0
Then I added the service with
But, when I start the system I got this on syslog:
open_tunnels: ssh: connect to host <IP> port 22: Network is unreachable
I am sure the ssh command works well because I use it on my system (after login). I just want it to be executed on startup.
Is there anything I am missing here?