Hello all,
As in the title, i need a simple script that checks if a PC is still on if not then the server shuts down.
I have:
ubuntu server 10.10
IP pc: 192.168.1.10
This is what i have got untill now
Code:
#!/bin/bash
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
fi
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 ...
Any help will be appreciate....
Thank you in advance!
Cheers,
Florin
Bookmarks