Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ping_targets="google.com2"
- failed_hosts=""
- file="alma2.txt"
- for i in $ping_targets
- do
- ping -c 1 $i > /dev/null
- if [ $? -ne 0 ]; then
- if [ "$failed_hosts" == "" ]; then
- failed_hosts="$i"
- else
- failed_hosts="$failed_hosts, $i"
- fi
- fi
- done
- if [ "$failed_hosts" != "" ]; then
- echo $failed_hosts
- if [ -f "$file" ]
- then
- echo "$file found."
- #ez lényegtelen
- else
- echo "$file not found."
- #email küldés # eza rész nincs meg
- echo 'qqqq' > $file
- fi
- else
- rm $file
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement