Network Connectivity Cron
This script checks if the network manager is running or if there is network connectivity, if not it restarts network manager. Great for cronjobs to check every 2 minutes to ensure remotely managed machines always stay online.
Copy the following script in the a new file, in this case I'm calling it check_network. Place it at the following location:
/usr/local/bin/check_network
Add the following line to /etc/crontab
. Change the */2
to whatever increment you want to have this script run in minutes. It's currently set to run /usr/local/bin/check_network
every two minutes.
Set the execute permissions on the script. As root, type:
To ensure the cronjob is running or not. Running the βsystemctlβ command along with the status flag will check the status of the Cron service as shown in the image below. If the status is βActive (Running)β then it will be confirmed that crontab is working perfectly well, otherwise not.
To edit or add/remove cron jobs:
Last updated