As in the title, i need a simple script that checks if a PC is still on if not then the server shuts down.
ubuntu server 10.10
IP pc: 192.168.1.10
This is what i have got untill now
If i run this from the webmin the server shuts down no matter if the PC is on or off...seems to me that i have make some mistakes...but i really don't know where ...
server_shutdown="ping -c4 192.168.1.10 2>&1 | grep 0\ received"
if [ ! "$server_shutdown" == "0\ received" ]; then
echo "Stopping server!"
sudo shutdown -h now
Any help will be appreciate....
Thank you in advance!