Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to create an interface that will show a message on the screen every set time. Cron is an ideal tool for this case only it doesn't read data from a file during it's run (as far as I could tell). I could create a bunch of file to read but this is redundant.

Is there a way to add a line into the user crontab file or remove a line from it after I have read it from a file?

share|improve this question
1  
I can't really see how your first paragraph connects to your second. What exactly are you trying to accomplish? "show a message on the screen every set time" is trivial; is the message changing each time? Does the contents of the message come from a file? –  Michael Mrozek Sep 11 '11 at 20:45
    
I've difficulties to understand what you really want, but I wonder if at wouldn't be a better solution than modifying the crontab. –  AProgrammer Sep 23 '11 at 19:46

1 Answer 1

up vote 1 down vote accepted

You can always write a cronjob that calls a script that conditionally calls crontab -l > oldcrontab and then executes crontab file. Where file would be the new crontab that should be installed, constructed from oldcrontab modulo an appended/removed line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.