Results 1 to 3 of 3
hi i want to know how to create an IF. I currently have serveral servers mounted using samba. I have a backup script atm which works well. However when a ...
- 01-24-2008 #1Just Joined!
- Join Date
- Jan 2008
- Posts
- 1
Shell Script
hi i want to know how to create an IF. I currently have serveral servers mounted using samba. I have a backup script atm which works well. However when a server goes off for whatever reason my backup deletes the files first and then goes to fetch the new data. When the server isnt present it doesnt copy any data so i loose a backup. Is there a way of using a IF in a shell script to detect a missing server e.g if ping timeout then dont delete
thanks
- 01-24-2008 #2
The following if statement preforms a ping on IP address 192.168.0.1 and then checks for the string "0 received" in the response.
Code:if [[ `ping -c1 192.168.0.1 | grep "0 received"` != "" ]] then echo "no ping" fiLinux User #453176
- 01-24-2008 #3
Or:
Code:ping -c1 -w1 192.168.0.1 >&- 2>&- ||echo "unreachable"


Reply With Quote