Bash script for checking telnet service status
cat monitor.sh
#!/bin/bash
source /etc/profile
cd /home/koala/Vagrant/windows-server-2019
(echo > /dev/tcp/192.168.178.220/23) > /dev/null 2>&1
if [ $? -ne 0 ]; then
vagrant halt
vagrant up
fi
cat monitor.sh
#!/bin/bash
source /etc/profile
cd /home/koala/Vagrant/windows-server-2019
(echo > /dev/tcp/192.168.178.220/23) > /dev/null 2>&1
if [ $? -ne 0 ]; then
vagrant halt
vagrant up
fi
Louis said:
apt install netcat
function restart () { pushd /home/koala/Vagrant/windows-server-2019 > /dev/null vagrant halt vagrant up popd }
function check () { until nc -vz -w ; do : ; done
restart
}
check
Louis said:
apt install netcat