Script how I get gust.
- Spoiler: show
- Spoiler: show
- Spoiler: show
Moderator: leecollings
Code: Select all
#!/bin/bash
while true; do
if (find /PATH/TO/XMLFILE -mmin +3 -type f | grep -q /); then
echo "$(date +%T) XML file not updating, potential fault detected, restarting the service..."
service NAME stop
service NAME start
fi
echo "$(date +%T) Sleeping for 30 seconds before next check"
sleep 30
done
Code: Select all
#!/bin/bash
while true; do
if (find /PATH/TO/XMLFILE -mmin +3 -type f | grep -q /); then
echo "$(date +%T) XML file not updating, potential fault detected, rebooting in 30 seconds..."
sleep 30
sudo reboot
fi
echo "$(date +%T) Sleeping for 30 seconds before next check"
sleep 30
done
Code: Select all
#!/bin/bash
target="192.168.0.5"
# Wait for network to come up
sleep 120
while true; do
echo "Checking target $target every minute for 15 minutes"
ping -c15 -i900 "$target" > /dev/null
if [ $? != 0 ]
then
sudo /sbin/shutdown -r now
fi
sleep 1
done
Users browsing this forum: No registered users and 1 guest