Good day everyone.
I have follow the solution in this topic to make the scrip for shutdown esxi host. (Bash Script If Ping Fails Then Automatically Reboot Server - Computer How To)
#!/bin/bash # Set target host IP or hostname TARGET_HOST='192.168.0.7' count=$(ping -c 3 $TARGET_HOST | grep from* | wc -l) if [ $count -eq 0 ]; then echo "$(date)" "Target host" $TARGET_HOST "unreachable, Rebooting!" >>/var/log/inetmonit.log /sbin/shutdown -h now else echo "$(date) ===-> OK! " >>/var/log/inetmonit.log fi
but when I add it to crond in my ESXi host it not work. and I don’t know how to check it. and I don’t know to rotation the log file
Could you please help me to this. Thank you so much