Home > ParetoLogic Blogs > Malware Diaries > Crontab way around in Linux
Reply
 
Thread Tools Display Modes
  #1  
Old 11-07-2009, 01:53 AM
Michael Michael is offline
Administrator
Join Date: May 2007
Posts: 313
Default 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.

crontab

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
Reply With Quote
Reply

« Previous Thread | Next Thread »

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Terms of Use