From f973875db4fdaaa8a91452cf546b7cf7661a37d3 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Mon, 23 Jul 2012 22:33:09 -0400 Subject: [PATCH] made the sound cycle slower so the script is less annoying when disconnected. --- scripts/security/start_tunnels.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/scripts/security/start_tunnels.sh b/scripts/security/start_tunnels.sh index 57c8255b..8d159064 100644 --- a/scripts/security/start_tunnels.sh +++ b/scripts/security/start_tunnels.sh @@ -42,14 +42,32 @@ SECURITY_KEY="-i $HOME/.ssh/id_dsa_fred" ############## +# how often to play sounds when reconnecting. +NOISE_PERIOD=60 + +# when we last played a sound. +LAST_SOUND_TIME=0 + +play_sound_periodically() +{ + CURRENT_TIME=$(date +"%s") + if (( $CURRENT_TIME - $LAST_SOUND_TIME >= $NOISE_PERIOD )); then + echo playing sound now. + bash $FEISTY_MEOW_SCRIPTS/multimedia/sound_play.sh $soundfile &>/dev/null /dev/null