Skip to content

Instantly share code, notes, and snippets.

@riskiwah
Created November 22, 2022 15:05
Show Gist options
  • Save riskiwah/e2e734e71defe41db81ebfa97e9802bb to your computer and use it in GitHub Desktop.
Save riskiwah/e2e734e71defe41db81ebfa97e9802bb to your computer and use it in GitHub Desktop.
DIY service up, suitable if combine with cron
import requests, subprocess
resp = requests.get("https://riskiwah.xyz")
if resp.status_code == 502:
print("Your Landing Pages is Down!!")
subprocess.call("docker-compose up -d", shell=True, cwd="/home/dietpi/code/wireguard-way/")
else:
print("Your Landing Pages is Up!!")
#!/bin/bash
STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://riskiwah.xyz)
if [ "$STATUS_CODE" == 502 ]; then
echo "Your Landing Pages is Down!!"
docker-compose -f code/wireguard-way/docker-compose.yaml up -d
else
echo "Your Landing Pages is Up!!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment