Difference between
modified post ea4c43a5 by Anonymous on Wed 31st Aug 2016 00:46
original post 9192d by Anonymous on Wed 31st Aug 2016 00:39
Download diff
Show
old version |
new version |
both versions
| 1 | 1 | #!/system/bin/sh | |
| 2 | 2 | export PATH=/system/xbin:$PATH | |
| 3 | - | IP="$(ip -f inet addr show wlan0 | awk -F / '/inet / {print $1}' | awk -F' ' '{print $2}')" | |
| 3 | + | IP="$(ip -f inet addr show wlan0 | awk -F'(/|[[:space:]]+)' '/inet / {print $3}')" | |
| 4 | 4 | PID="$(pidof dropbear)" | |
| 5 | 5 | ||
| 6 | 6 | echo IP: $IP | |
| 7 | 7 | echo PID: $PID | |
| 8 | 8 | ||
| 9 | 9 | if [ -n "$IP" ]; then | |
| 10 | 10 | echo IP Check Succeeded | |
| 11 | 11 | if [ -z "$PID" ]; then | |
| 12 | 12 | echo PID Check Succeeded: dropbear not running | |
| 13 | 13 | busybox nice -n -5 /data/dropbear/dropbear -A -N root -C '<somepassword>' -T /data/dropbear/authorized_keys -U 0 -G 0 -r /data/dropbear/dropbear_rsa_host_key -p 22 -e | |
| 14 | 14 | return="$?" | |
| 15 | 15 | if [ "$return" -ne "0" ]; then | |
| 16 | 16 | echo "dropbear failed to start ($return)" | |
| 17 | 17 | else | |
| 18 | 18 | echo dropbear started | |
| 19 | 19 | fi | |
| 20 | 20 | else | |
| 21 | 21 | echo dropbear already running: nothing to do | |
| 22 | 22 | fi | |
| 23 | 23 | else | |
| 24 | 24 | echo IP Check failed | |
| 25 | 25 | if [ -n "$PID" ]; then | |
| 26 | 26 | echo PID Check Succeeded: killing dropbear | |
| 27 | 27 | killall dropbear | |
| 28 | 28 | sleep 5 | |
| 29 | 29 | killall -9 dropbear | |
| 30 | 30 | echo dropbear killed | |
| 31 | 31 | else | |
| 32 | 32 | echo dropbear not running: nothing to do | |
| 33 | 33 | fi | |
| 34 | 34 | fi |
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
kpaste.net RSS