diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2026-01-04 22:59:49 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2026-01-04 22:59:49 +0530 |
| commit | 0b3f6a14ea950529efd8a298b5939481744c0ecc (patch) | |
| tree | d21e3bc3eab12b636f96e4412fb77c07803a3b70 /modules/scripts/warp-stop.sh | |
| parent | 6b2cb30a1ae24149d0059e6441296a20d0528adb (diff) | |
| download | home-manager-config-0b3f6a14ea950529efd8a298b5939481744c0ecc.tar.gz home-manager-config-0b3f6a14ea950529efd8a298b5939481744c0ecc.zip | |
Added convenience to automatically start and stopped cloudflare warp
Diffstat (limited to 'modules/scripts/warp-stop.sh')
| -rw-r--r-- | modules/scripts/warp-stop.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/scripts/warp-stop.sh b/modules/scripts/warp-stop.sh new file mode 100644 index 0000000..c374c8a --- /dev/null +++ b/modules/scripts/warp-stop.sh @@ -0,0 +1,38 @@ +set -euo pipefail + +stop_daemon() { + if systemctl list-unit-files | grep -q '^warp-svc\.service'; then + echo "Stopping warp-svc via systemd..." + sudo systemctl stop warp-svc.service + return + fi + + if pgrep -x warp-svc >/dev/null 2>&1; then + echo "Killing warp-svc process..." + sudo pkill -x warp-svc + else + echo "warp-svc is not running." + fi +} + +disconnect_client() { + echo "Disconnecting from WARP..." + if warp-cli status 2>&1 | grep -qi "Connected"; then + sudo warp-cli disconnect + echo "Disconnected." + else + echo "WARP is already disconnected." + fi +} + +main() { + disconnect_client + stop_daemon + + echo "Final status:" + warp-cli status || true + sudo systemd-resolve --flush-caches + sudo systemctl restart systemd-resolved +} + +main "$@" |
