-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwifisniffer.sh
executable file
·82 lines (69 loc) · 1.18 KB
/
wifisniffer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
PID=""
WLDEV_DEFAULT="phy0_mon0"
APP_NAME="wifisniffer"
get_pid () {
PID=`cat $APP_NAME.pid`
}
stop () {
get_pid
if [ -z $PID ]; then
echo "$APP_NAME is not running."
exit 1
else
echo -n "Stopping $APP_NAME..."
kill $PID
rm $APP_NAME.pid
sleep 1
echo "... Done."
fi
}
start () {
get_pid
_now=$(date +"%m_%d_%Y_%HH:%MM:%SS")
if [ -z $PID ]; then
echo "Starting $APP_NAME $*..."
#./$APP_NAME 2> $APP_NAME.log 2>&1
./$APP_NAME 2> $APP_NAME.log &
echo $! > $APP_NAME.pid
get_pid
echo "Done. PID=$PID"
else
echo "$APP_NAME is already running, PID=$PID"
fi
}
restart () {
echo "Restarting Strategy..."
get_pid
if [ -z $PID ]; then
start
else
stop
start
fi
}
status () {
get_pid
if [ -z $PID ]; then
echo "$APP_NAME is not running."
exit 1
else
echo "$APP_NAME is running, PID=$PID"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
esac