Skip to content

Instantly share code, notes, and snippets.

@onokatio
Last active October 19, 2017 03:06
Show Gist options
  • Save onokatio/dd9ccc24d7f32586286aef98d62301af to your computer and use it in GitHub Desktop.
Save onokatio/dd9ccc24d7f32586286aef98d62301af to your computer and use it in GitHub Desktop.
NetowrkManagerで特定のWiFiに繋がったタイミングで自動でコマンドを実行させる ref: http://qiita.com/onokatio/items/d9297e567e9cc75586ed
#!/bin/bash
if [ "$1" == wlan0 ] && iwconfig wlan0|grep HogeHogeAccessPoint; then
if ! ps ax|grep "[s]sh -fND 8080"; then
ssh -fND 8080 [email protected] -i /home/onokatio/.ssh/id_rsa -o "StrictHostKeyChecking no"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment