[clue-tech] simple one-liner to add to crontab?

David L. Willson DLWillson at TheGeek.NU
Fri Apr 10 11:29:27 MDT 2009


So I figured out that that works:

$ echo -e "$(crontab -l)\n *   *   *   *   *  newcronjob" | crontab -

Are you saying that this would work as well, and more simply?

$ echo " *   *   *   *   *  newcronjob" >> /var/spool/crontabs/username

Testing...  Hmm, not what I expected.  My crontab is in a slightly different location, but that doesn't matter.  What does matter is that, even though I have w to my crontab, I don't have access to the folder it's in, and I can't append to it.

$ echo " *   *   *   *   *  newcronjob" >> /var/spool/cron/crontabs/dlwillson
bash: /var/spool/cron/crontabs/dlwillson: Permission denied

$ sudo ls -l /var/spool/cron/crontabs/dlwillson
-rw------- 1 dlwillson crontab 348 2009-04-10 11:18 /var/spool/cron/crontabs/dlwillson

So, I'll stick with the more complex but functional one-liner for now.

David L. Willson
Trainer, Engineer, Enthusiast
MCT, MCSE, Linux+
tel://720.333.LANS
Freeing people from the tyranny (or whatevery) of Microsofty-ness, one at a time.

----- "Angelo Bertolli" <angelo.bertolli at gmail.com> wrote:

> My cron is under /var/spool/cron/crontabs/username, and it's writable
> by me.
> 
> 
> David L. Willson wrote:
> > So, there's a simple one-liner to add something to my bash profile:
> >
> > echo "alias rd='rdesktop -f -0'" >> ~/.bashrc
> >
> > Is there a similarly simple one-liner to add something my crontab?
> >
> > David L. Willson
> > Trainer, Engineer, Enthusiast
> > MCT, MCSE, Linux+
> > tel://720.333.LANS
> > Freeing people from the tyranny (or whatevery) of Microsofty-ness,
> one at a time.
> > _______________________________________________
> > clue-tech mailing list
> > clue-tech at cluedenver.org
> > http://www.cluedenver.org/mailman/listinfo/clue-tech
> >   
> 
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://www.cluedenver.org/mailman/listinfo/clue-tech


More information about the clue-tech mailing list