Skip to content

Instantly share code, notes, and snippets.

@mehmetg
Created March 26, 2016 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehmetg/9cdc77269ddef72ebc84 to your computer and use it in GitHub Desktop.
Save mehmetg/9cdc77269ddef72ebc84 to your computer and use it in GitHub Desktop.
Stops SC and relies on the pid files created by https://gist.github.com/mehmetg/20c2a0f9df25424e130a
#!/usr/bin/env bash
cat /tmp/sc*.pid
pids=$(cat /tmp/sc*.pid)
if ! [[ -z $pids ]]; then
echo $pids | xargs kill
fi
ctr=0
while ! [[ -z $(ls /tmp/sc*.pid |grep pid) ]] && [[ ctr -lt 100 ]];
do
echo "Waiting for tunnel shutdown ${ctr}"
let ctr=ctr+1
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment