troubleshooting Question

if then time sensitive command shell script scp

Avatar of libertyforall2
libertyforall2Flag for United States of America asked on
Linux OS DevProgrammingShell Scripting
5 Comments1 Solution438 ViewsLast Modified:
    Currently I am using the code below. I want to kill the portion of the code at the bottom if the time is between 12am and 1:59am local time. How would I do that? Also, I would like to look for a file and if the file is not there, then that portion of the code would be killed as well. So it would be something like if it is not 12am to 1:59am local time and /path/file.txt exists then run this command else die.

other code stuff
other code stuff
other code stuff

yy=`date +%Y`
mm=`date +%m`
dd=`date +%d`

echo "Today is : $yy $mm $dd"

# Edit latest.txt file
  echo "${yy}${mm}${dd}00"            >latest.txt 
scp latest.txt user@server:path/

nociSoftware Engineer
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros