Crontab way around in Linux
I’m trying to run a script with crontab so that it runs at a certain time. Nothing new here…
However, my script involves PGP and for some strange reason, PGP will not decrypt anything while in crontab (user-agent blablabla… and other bogus errors). The frustrating thing was that the script runs just fine if I manually run it.
Anyway, since crontab did not want to cooperate
I decided to create my own scheduler. First you need a script that loops indefinitely, and then this piece of code will execute myscript.sh at 1 PM every day.
You create a variable and you assign it the current time. A little sed removes the colon (i.e. 13:00)
Then if the variable equals the time you manually preset, it’s a Go!
Hey, it may not be very pretty, but it saved me a lot of time!
It’s funny in our jobs how many times we’re stuck on something that just doesn’t make any sense. I usually try a quick way around which saves me hours.
Jerome Segura
Comments:
|
|





