Commit 77ee9885 authored by nanahira's avatar nanahira

fix daemon down

parent f39a194f
Pipeline #16424 passed with stages
in 2 minutes and 28 seconds
#!/bin/bash #!/bin/bash
echo '' > /var/lib/cloudflare-warp/cfwarp_service_log.txt echo '' > /var/lib/cloudflare-warp/cfwarp_service_log.txt
warp-svc & daemonPid=0
daemonReady=1
while [[ "$daemonReady" != "0" ]]; do
echo "Waiting for daemon start"
grep "cloudflare-warp/warp_service" /var/lib/cloudflare-warp/cfwarp_service_log.txt
daemonReady=$?
done
echo "Daemon started"
initProxy() { initProxy() {
warp-svc &
daemonPid=$!
daemonReady=1
while [[ "$daemonReady" != "0" ]]; do
echo "Waiting for daemon start"
grep "cloudflare-warp/warp_service" /var/lib/cloudflare-warp/cfwarp_service_log.txt
daemonReady=$?
done
echo "Daemon started"
if [[ ! -f "/var/lib/cloudflare-warp/reg.json" ]]; then if [[ ! -f "/var/lib/cloudflare-warp/reg.json" ]]; then
if [[ -n "$WARP_LICENSE" ]]; then if [[ -n "$WARP_LICENSE" ]]; then
warp-cli --accept-tos set-license "$WARP_LICENSE" warp-cli --accept-tos set-license "$WARP_LICENSE"
...@@ -24,6 +26,11 @@ initProxy() { ...@@ -24,6 +26,11 @@ initProxy() {
warp-cli connect warp-cli connect
} }
restartProxy() {
kill $daemonPid
initProxy
}
watcher() { watcher() {
workedOnce=0 workedOnce=0
while true; do while true; do
...@@ -35,7 +42,7 @@ watcher() { ...@@ -35,7 +42,7 @@ watcher() {
echo "Proxy is still starting up" echo "Proxy is still starting up"
else else
echo "Proxy is down, restarting" echo "Proxy is down, restarting"
initProxy restartProxy
fi fi
sleep 10 sleep 10
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment