Little bit stuck here with how I should go about this. I have 3 machines, firewall, utilserv and my main machine (oblivion) which I want to run this script from.
Heres the deal. I have just moved house and have had to go back to a dialup connection. Ive rebuilt my firewall scripts to masquerade and share my dialup. Thing is, because its not always online I need to be able to script the connection from my main machine.
I'll post what I have to see if it makes things clearer.
Code:
#!/bin/bash
case "${1}" in
start)
ssh firewall sudo wvdial
ssh firewall sudo /usr/sbin/firewall.sh
ssh firewall sudo /etc/init.d/ntp-client start
ssh utilserv sudo /etc/init.d/ntp-client start
sudo /etc/init.d/ntp-client start
;;
stop)
ssh firewall sudo kill $(pidof wvdial)
ssh firewall sudo kill $(pidof pppd)
;;
esac
exit 0
As you can see. From my main machine (running this script) Id'e like to ssh to the firewall, dialup a connection, start the firewall.sh (iptables) script then sync my clocks on all machines.
The stop functionality should disconnect the dialup.
This script partly works. I get the connection, the firewall kicks in and I can use the net from any machine, but, it never gives me my prompt back. It seems to stop after starting the firewall as there is no message about ntp-client starting.
Then, when I go to stop the connection I just get the Uage for kill displayed twice and my modem will not hang up. I have to login to the firewall and kill the process manually.
Am I going abou this all wrong or does anyone have a better solution?
Eventually Id'e like to be able to make connect and disconnect available as fluxbox keyboard shortcuts to make it easy for my girlfriend to get connected. I never had to worry about it before because we had ADSL and where always ON.
Any ideas welcomed. Thanks.