init upload
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
[ -z "$GS_SECRET" ] && GS_SECRET="$1"
|
||||
[ -z "$GS_SECRET" ] && printf 'Enter GSocket secret: ' && read -r GS_SECRET
|
||||
[ -z "$OVPNCFG" ] && OVPNCFG="$2"
|
||||
[ -z "$OVPNCFG" ] && OVPNCFG="client.ovpn"
|
||||
|
||||
GSPIDFILE='/tmp/gswarp-gs.pid'
|
||||
OVPIDFILE='/tmp/gswarp-ov.pid'
|
||||
|
||||
BEFORE_PIDS=$(pgrep -x gs-netcat 2>/dev/null)
|
||||
gs-netcat -D -s "$GS_SECRET" -p 1194
|
||||
sleep 0.5
|
||||
AFTER_PIDS=$(pgrep -x gs-netcat 2>/dev/null)
|
||||
|
||||
if [ -n "$BEFORE_PIDS" ]; then
|
||||
echo "$AFTER_PIDS" | grep -v -F -x "$BEFORE_PIDS" > "$GSPIDFILE"
|
||||
else
|
||||
echo "$AFTER_PIDS" > "$GSPIDFILE"
|
||||
fi
|
||||
|
||||
sudo openvpn --daemon gs-warp --config "$OVPNCFG" --writepid "$OVPIDFILE"
|
||||
|
||||
echo 'GS-Warp started'
|
||||
Reference in New Issue
Block a user