pastebin - collaborative debugging tool
kpaste.net RSS

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

    
11
#!/system/bin/sh
22
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}')"
44
PID="$(pidof dropbear)"
55
66
echo IP: $IP
77
echo PID: $PID
88
99
if [ -n "$IP" ]; then
1010
	echo IP Check Succeeded
1111
	if [ -z "$PID" ]; then
1212
		echo PID Check Succeeded: dropbear not running
1313
		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
1414
		return="$?"
1515
		if [ "$return" -ne "0" ]; then
1616
			echo "dropbear failed to start ($return)"
1717
		else
1818
			echo dropbear started
1919
		fi
2020
	else
2121
		echo dropbear already running: nothing to do
2222
	fi
2323
else
2424
	echo IP Check failed
2525
	if [ -n "$PID" ]; then
2626
		echo PID Check Succeeded: killing dropbear
2727
		killall dropbear
2828
		sleep 5
2929
		killall -9 dropbear
3030
		echo dropbear killed
3131
	else
3232
		echo dropbear not running: nothing to do
3333
	fi
3434
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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at