generated from pavel.muhortov/template-bash
added status
This commit is contained in:
parent
d773f2bd66
commit
1c1b787d54
|
@ -41,6 +41,14 @@ stop() {
|
|||
rm -f "/etc/wireguard/${wifname}.key"
|
||||
}
|
||||
|
||||
status() {
|
||||
if ip a grep -q -w "${wifname}"; then
|
||||
ip a | grep -w "${wifname}"
|
||||
else
|
||||
echo "${wifname} down"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
|
@ -50,10 +58,14 @@ case "$1" in
|
|||
;;
|
||||
restart)
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user