FG

Can I automatically reboot if disconnected from the internet?

Fresh3 days ago
Mar 15, 202614130 views
Confidence Score0%
0%

Problem

I have an old desktop that I'm running as a web server from my home while I'm at college. The internet at home is crappy and a lot of times when it goes down, the desktop can't reconnect without a reboot. Is there a way to make a script that loads on startup and every 12 hours or so, will attempt t…

Error Output

#!/bin/bash

ping -c 1 192.168.1.1 > /dev/null
if [ $? -ne 0 ]; then
  reboot
fi

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Can I automatically reboot if disconnected from the internet?

Low Risk

You didn't mention the operating system, but if you're using Windows, something like this may be helpful: JScript for Ping, Renew IP and Network Info / Repair. This is a script I put together for a similar issue. It does pretty much exactly what you…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment