Results 1 to 6 of 6

Thread: Cron job error

  1. #1
    Join Date
    Apr 2009
    Location
    Saitama, Japan
    Beans
    132
    Distro
    Ubuntu 10.04 Lucid Lynx

    Cron job error

    I am receiving cron job error via email for amavis-new program.
    Code:
    Cron <amavis@web-server> test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-syn
    
    bayes: cannot open bayes databases /etc/spamassassin/bayes_* R/O: tie failed: Permission denied
    bayes: expire_old_tokens: locker: safe_lock: cannot create tmp lockfile /etc/spamassassin/bayes.lock.web-server.20927 for /etc/spamassassin/bayes.lock: Permission denied
    I don't know exactly what I did to cause this error. It maybe from using this script taken from this blog. It is a script to run sa-learn for spamassassin using a cron job.

    I can't imagine the script is at fault but I am no expert. Which is why I am consulting the real experts here.

  2. #2
    Join Date
    Aug 2010
    Beans
    6
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Cron job error

    Hi,

    Can you try to set the particular cron as root user . It seems the user that runs the cron doesn't have permission to access the said files/dirs.

    Uptime

  3. #3
    Join Date
    Apr 2009
    Location
    Saitama, Japan
    Beans
    132
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Cron job error

    Thanks for the reply. How would I do that. Here is the cron job script.
    #
    # SpamAssassin maintenance for amavisd-new
    #
    # m h dom mon dow user command
    18 */3 * * * amavis test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-sync

  4. #4
    Join Date
    Jun 2009
    Beans
    24
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Cron job error

    I have same error message.

    This file is in /root

    File name: rsync-shell.sh

    PHP Code:
    #!bin/bash
    sudo rsync -az --delete /home/mark/music/ /mymounts/d2p1/home_backup 
    If I "sudo crontab -l" I get:

    PHP Code:
    # m h dom mon dow
    * * * * /root/rsync-shell.sh 

    I continually receive this message on my servers mail from cron daemon:
    PHP Code:
    /bin/sh: /root/rsync-shell.shPermission denied 
    I thought that by putting the rsync-shell.sh in root that permissions would be no problem, but I guess I am wrong.

    There is a difference if I "sudo crontab -e" or "crontab -e" if I do not use sudo it says "there is no crontab for mark" (I am only user on server as mark).

    I am new this year to Ubuntu headless server, am learning loads but I surely have to work at it!

    Help anyone?

    Edit to add: I created a crontab -e without "sudo", entered the 0 * * * * /root/rsync-shell.sh file and it failed with same reason.
    Last edited by mw4jet; January 15th, 2011 at 06:51 PM.

  5. #5
    Join Date
    Jun 2009
    Beans
    24
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Cron job error

    Is it possible the "--delete" is causing the permission error?

    ( I try to learn and read on the forum and web before posting because most times there is no response, I hope to hear from someone this time)

  6. #6
    Join Date
    Jun 2009
    Beans
    24
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Cron job error

    Needed to be "su" and create crontab -e.

    Thanks anyway, kept searching an got it figured out here

Bookmarks

Posting Permissions

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