Re: scripting crontab entries

From: Lowell Gilbert (freebsd-questions-local_at_be-well.ilk.org)
Date: 02/16/05

  • Next message: Timothy Radigan: "RE: Setting upFreeBSD with D-Link Wireless Router"
    To: Peter Risdon <peter@circlesquared.com>
    Date: 16 Feb 2005 08:55:18 -0500
    
    

    Peter Risdon <peter@circlesquared.com> writes:

    > I want to be able to update a user's crontab from a script. tabs
    > in /var/cron/tabs carry a warning that the file should not be edited
    > directly, so presumably something like
    >
    > #echo "5 * * * * /some/script.sh" >> /var/cron/tabs/$USER
    >
    > is the wrong approach. Is the right approach:
    >
    > #cat ~/.mycrontab
    > 5 * * * * /some/script.sh
    >
    > #crontab ~/.mycrontab
    >
    > The right way to go? I notice this approach blows away existing crontab
    > entries, and was hoping to be able to append new ones instead, but then
    > by treating ~/.mycrontab as the master file, I can manage this OK.

    How about:

    crontab -u $USER -l > crontab.file.$USER
    echo "5 * * * * /some/script.sh" >> crontab.file.$USER
    crontab -u $USER crontab.file.$USER
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Timothy Radigan: "RE: Setting upFreeBSD with D-Link Wireless Router"

    Relevant Pages

    • RE: Why this crontab does not work?
      ... Why this crontab does not work? ... apt-get upgrade -d ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
      (Debian-User)
    • Re: Postgres
      ... see a reason why other users should access /root) ... chmod 600 /root/.pgpass ... >> I'm trying to write a backup script for postgres and us a crontab on it. ... > To unsubscribe, ...
      (freebsd-stable)
    • RE: crontab
      ... I have to enter my crontabs with a dot between the days field and the script ... Database Administrator ... - did u restart the cron deamon after you made changes to the crontab? ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • Re: Shell eroor while running crontab daemon
      ... Now I have the folling in my crontab. ... After I got the error message, ... >> Do you Yahoo!? ...
      (RedHat)
    • Re: Crontab Problem
      ... neither the crontab command nor the cron daemon ... the crontab will appear to load ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
      (Debian-User)