Linux Bash ... If time > 20:00 then echo 'hello' fi -
i'm very new linux bash , i'm not sure if want can achieved.
i have program runs 24/7 uploading 1 of servers cloud. problem is, killing bandwidth.
so idea let run 00:05 05:55 , no 1 busy @ time of night.
so like:
if $(date +"%t") < 05:55 backup.sh else killbackup.sh fi
try this:
#!/bin/bash h=$(date +"%k") # current hour (24h) without leading 0 m=$(date +"%m") # current minute t=$[h*60+m] # calculate minutes since midnight # -gt: greater-than, -lt: less-than if [[ $t -gt 5 ]] && [[ $t -lt 355 ]]; # run 0:06 5:54 backup.sh else # run 5:55 0:05 killbackup.sh fi
Comments
Post a Comment