-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnpv
More file actions
executable file
·40 lines (34 loc) · 714 Bytes
/
npv
File metadata and controls
executable file
·40 lines (34 loc) · 714 Bytes
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
#!/bin/sh
set -e
set -u
# shellcheck source=/dev/null
. "$ZDOTDIR"/10_globals.zsh
# shellcheck source=/dev/null
. "$ZDOTDIR"/11_locals.zsh
OPENVPN_PID_FILE="/var/run/openvpn/openvpn.pid"
safe_k(){
if [ -n "$1" ]; then
echo "trying to kill"
kill "$1"
sleep 1
kill -9 "$1"
fi
}
kill_bt(){
# pkill "$(which deluge)"
safe_k "$(pidof "$(which qbittorrent)")" &
safe_k "$(pidof "$(which transmission-gtk)")" &
# pkill -9 /usr/bin/deluge
wait
}
finish(){
echo finishing
kill_bt
}
trap finish 1 2 3 15
if pgrep openvpn; then
echo "VPN already running?"
else
cd "$VPN_CONFIG_DIR" && sudo openvpn --writepid "$OPENVPN_PID_FILE" --config cstorm_linux-balancer_udp.ovpn
finish
fi