Find the answer to your Linux question:
Results 1 to 4 of 4
Good Morning, I am new to Linux and so still have a lot to learn ... I have a file called crontab in /etc/crontab, and I can edit it using ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    13

    Angry crontab problems

    Good Morning,

    I am new to Linux and so still have a lot to learn ...

    I have a file called crontab in /etc/crontab, and I can edit it using
    vi /etc/crontab.

    I have an entry, as follows ...

    0/1 * * * * ~/public_html/swordfish/call_centre/cron/auto_report_fred.sh

    BUT cron does NOT run it. Why not ?

    Another problem is when I use the crontab command 'crontab -e' to edit the crontab file, it creates a new one and does not see my manual changes.

    I have also tried create a crontab file like this 'crontab <filename>'
    but that reports the following error ....

    "no crontab for root - using an empty one"

    How do I use crontab correctly ??

    regards,

    Steven M

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    You can find tons of cron info via Google => Example

    Edit cron for the current user you are logged in as:

    Code:
    crontab -e
    Edit cron for another user (only root can do this):

    Code:
    crontab -u <user> -e
    A ~ means the home folder of whatever user the crontab is running under. So if the crontab's user is roger, then it's looking for /home/roger (assuming default home dir.)

    Root's home is /root usually (on Linux.)

    To view crontab's, use the list switch:

    Code:
    crontab -l

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    25
    crontab usually goes under /var/spool/cron/tab/user_name may vary by linux flavor.

    Where ever it is it should never be directly edited, Only use crontab -e to edit the entry.

  4. #4
    Just Joined! TuxKnight's Avatar
    Join Date
    Sep 2008
    Location
    New Zealand
    Posts
    28

    Crontab

    You might want to do a backup of the original crontab file before using crontab -e

    Creating a copy
    Code:
    crontab -l > /root/crontab.orig.<date>
    To restore use the following
    Code:
    crontab /root/crontab.orig.<date>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...