0
rated 0 times
[
0]
[
0]
/ answers: 1 / hits: 3104
/ 1 Year ago, sun, april 17, 2022, 11:38:04
#!/bin/bash
tag=$(awk -F, 'NR==1{print $1}' /tmp/time.txt)# output: 17:00
sub_time=$(date -d"${tag} +1:00" +'%H:%M')output: 16:00
current_time=$(date |awk 'NR==1{print $4}' output: 05:51:16
if [[ "$sub_time" -ge "$current_time" ]];then
crontab <<EOF
*/15 * * * * bash server_shutdown.sh
EOF
fi
I want to compare the "current_time" in the current system to the VM shutdown tag from VM with "sub_time" through the if condition.
More From » bash