OpenAgricultureFoundation / openag-device-software

Software for running controlled grow environments on Linux / OSX machines and embedded linux devices such as Beaglebones and Raspberry Pis.
GNU General Public License v3.0
194 stars 49 forks source link

add autossh watchdog #94

Closed jakerye closed 6 years ago

jakerye commented 6 years ago

it seems like serveo loses its connection when networks come up and down....need a simple way to ensure it is always up...perhaps just a shell script that runs every 5 min via cron. script checks if it has network comms, if so tries to ping its serveo comm, and if it is not successful, kills the autossh process then restarts it

see rob's connect_wifi.sh as a starting point

# We must restart autossh, otherwise serveo.net won't let us back in.
sleep 4
sudo killall -s 9 autossh > /dev/null 2>&1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/..
./forward_ports.sh > /dev/null 2>&1
rbaynes commented 6 years ago

That script has been updated to:

# We must restart autossh, otherwise serveo.net won't let us back in.
sleep 4
sudo killall -s 9 autossh > /dev/null 2>&1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
python $DIR/forward_ports.py > /dev/null 2>&1

Thanks, Rob Baynes pronouns: he / him / his

On Wed, Aug 29, 2018 at 8:46 AM, Jake Rye notifications@github.com wrote:

it seems like serveo loses its connection when networks come up and down....need a simple way to ensure it is always up...perhaps just a shell script that runs every 5 min via cron. script checks if it has network comms, if so tries to ping its serveo comm, and if it is not successful, kills the autossh process then restarts it

see rob's connect_wifi.sh as a starting point

We must restart autossh, otherwise serveo.net won't let us back in.

sleep 4 sudo killall -s 9 autossh > /dev/null 2>&1 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR/.. ./forward_ports.sh > /dev/null 2>&1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenAgInitiative/openag-device-software/issues/94, or mute the thread https://github.com/notifications/unsubscribe-auth/AK6m73TI2dahcD8qOi9HAaWfk9y-PSVpks5uVo0ygaJpZM4WRd9t .

jakerye commented 6 years ago

fixed in ea9734760f08a692619b563394fd15ea8d8b46fc -> e00b4aabbf5e87cd0740172816f477c8286b5ff4

rbaynes commented 6 years ago

Thanks @jakerye I will add another issue for myself to update the connect tab to use the same remote URL

Thanks, Rob Baynes pronouns: he / him / his

On Thu, Sep 6, 2018 at 8:14 AM, Jake Rye notifications@github.com wrote:

fixed in ea97347 https://github.com/OpenAgInitiative/openag-device-software/commit/ea9734760f08a692619b563394fd15ea8d8b46fc -> e00b4aa https://github.com/OpenAgInitiative/openag-device-software/commit/e00b4aabbf5e87cd0740172816f477c8286b5ff4

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAgInitiative/openag-device-software/issues/94#issuecomment-419071426, or mute the thread https://github.com/notifications/unsubscribe-auth/AK6m70aV4PIweZleg8EVN1AUYj7hUSgVks5uYRGZgaJpZM4WRd9t .