Results 1 to 6 of 6

Thread: chron.weekly script not running?

  1. #1
    Join Date
    Oct 2008
    Location
    Sunny Arizona
    Posts
    251

    Default chron.weekly script not running?

    I put a script in the cron.weekly folder, and made sure it is executable.

    The script executes perfectly when I run it by clicking in a konqueror window or from the command line, but doesn't run otherwise. Is there something I need to do for cron to "see" the script other than just put it in the cron.weekly folder?

    Thank you.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,884

    Default Re: chron.weekly script not running?

    Scripts in cron.weekly are run by root.

    You do not explain you tested running as root, when tested when runninga as a normal user a lot of things might be different.

    Pathes in the sript should be absolute when possible.

    I can go on with several possibilities, but it would have been easier fur us when you would have shown in your post what you did (we have copy/paste and the CODE tags here to make that easy!). Like an ls -l of you script. And at least the first few lines of the script. As I saw someone explaining in another thread: I have broken my crystal ball.
    Henk van Velden

  3. #3
    Join Date
    Oct 2008
    Location
    Sunny Arizona
    Posts
    251

    Default Re: chron.weekly script not running?

    Thanks for responding hcw. Here's some more info:

    Here's the contents of the script. It's just a simple rsync backup:

    Code:
    #!/bin/bash
    rsync -r -t -p -o -g -v --progress --delete --exclude backup --exclude temp --exclude freya --exclude rsynctest /home/queequeg/ /fullbackup/queequeg/
    The script is named "fullbackup" and it's in the /etc/cron.weekly/ directory.

    It is owned by root, and I tested it as root. It is executable. The paths are absolute.

    Any suggestions would be greatly appreciated.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,884

    Default Re: chron.weekly script not running?

    Quote Originally Posted by queequeg View Post
    The script is named "fullbackup" and it's in the /etc/cron.weekly/ directory.

    It is owned by root, and I tested it as root. It is executable. The paths are absolute.

    Any suggestions would be greatly appreciated.
    I suppose this is the long story for what could have be simply the output of
    Code:
    ls -l /etc/cron.weekly
    I do trust you, but in fact I do trust the computer more

    At least for testing, you could add an echo statement before and/or after your rsync call and redirect that to a log file, so you would a least see if it runs
    Code:
    #!/bin/bash
    exec >/tmp/fullbackup-log 2>&1
    echo "Fullbackup starts"
    rsync ..........
    echo "Fullbackup ends"
    I must admit that I do not use the cron.weekly and sisters. I simply (in a root console session) used crontab -e to create old fashioned crontab entries. I do not even know when exactly cron.weekly have to run, but when creating with crontab -e you can decide for yourself. So I put the script in /root/bin and make a crontab entry like:
    Code:
    5 0 * * 1 /root/bin/fullbackup >/tmp/fullbackup-log 2>&1
    (you do not need the exec in he script as shown above).
    Henk van Velden

  5. #5
    Join Date
    Oct 2008
    Location
    Sunny Arizona
    Posts
    251

    Default Re: chron.weekly script not running?

    Thanks again hcw. Good idea with the echo.

    I used to do "old fashioned" crontab entries, but my computer is only turned on sporadically so backups would get missed for long periods of time. cron.weekly doesn't have a set time to run, so I thought it would work better for me.

    If anybody has had success using the cron.daily, cron.weekly, etc. folders, please let me know if you can see something wrong with my setup above.

    Thank you.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,884

    Default Re: chron.weekly script not running?

    A quicky about the cron.* way of working.

    You start with the "system crontab" /etc/crontab. In my system this reads:
    Code:
    SHELL=/bin/sh
    PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
    MAILTO=root
    #
    # check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
    #
    -*/15 * * * *   root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons                                                                              >/dev/null 2>&1
    The contents of an entry in the system crontab differs from a normal crontab (e.g. a uername field is added).
    That means that the trick of the weekly, etc. is in /usr/lib/cron/run-crons. I have no time to study it now, but you could try
    Henk van Velden

Posting Permissions

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