Updated the script to check in every 45 seconds
This commit is contained in:
@@ -18,7 +18,7 @@ echo "=========================================="
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Prompt for endpoint URL
|
# Prompt for endpoint URL
|
||||||
read -p "Enter the endpoint URL (e.g., https://example.com/your-endpoint): " endpoint_url
|
read -p "Enter the endpoint URL (e.g., https://example.com/api/push/xxxxxxxxxxxxxxxxxxxxx): " endpoint_url
|
||||||
|
|
||||||
# Validate URL format
|
# Validate URL format
|
||||||
if [[ ! "$endpoint_url" =~ ^https?:// ]]; then
|
if [[ ! "$endpoint_url" =~ ^https?:// ]]; then
|
||||||
@@ -32,7 +32,7 @@ tee /opt/monitor_checkin.sh > /dev/null <<EOF
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
url="$endpoint_url"
|
url="$endpoint_url"
|
||||||
interval=55
|
interval=45
|
||||||
|
|
||||||
# Wait for network connectivity
|
# Wait for network connectivity
|
||||||
echo "Waiting for network connectivity..."
|
echo "Waiting for network connectivity..."
|
||||||
@@ -41,7 +41,7 @@ while ! curl -s --connect-timeout 5 "\$url" > /dev/null 2>&1; do
|
|||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Network is ready. Script started. Calling URL every 55 seconds..."
|
echo "Network is ready. Script started. Calling URL every 45 seconds..."
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
curl -s "\$url" > /dev/null
|
curl -s "\$url" > /dev/null
|
||||||
@@ -58,7 +58,7 @@ chmod +x /opt/monitor_checkin.sh
|
|||||||
echo "Creating systemd service..."
|
echo "Creating systemd service..."
|
||||||
tee /etc/systemd/system/monitor_checkin.service > /dev/null <<EOF
|
tee /etc/systemd/system/monitor_checkin.service > /dev/null <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Call URL Every 55 Seconds to check in with the monitoring server
|
Description=Call URL Every 45 Seconds to check in with the monitoring server
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user