Crontab error

Discussion in 'Server Operation' started by Captain, Apr 11, 2013.

  1. Captain

    Captain Member

    Hello!

    I have cron to backup my server files to external drive.
    When I run it manually it runs without problem.

    But script want not work via cron on Debian 6. I have the same script and crontab on Ubuntu 12.04 and it works without problem.

    crontab
    Code:
    * * * * * /usr/local/ispconfig/server/server.sh > /dev/null 2>> /var/log/ispconfig/cron.log
    30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null 2>> /var/log/ispconfig/cron.log
    20 4 11 * * /1/backup_server.sh > /dev/null
    
    
    error:
    Code:
    Apr 11 11:20:01 srv /USR/SBIN/CRON[22590]: (root) CMD (/1/backup_server.sh > /dev/null)
    Apr 11 11:20:01 srv /USR/SBIN/CRON[22589]: (getmail) CMD (/usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log)
    Apr 11 11:20:01 srv /USR/SBIN/CRON[22585]: (CRON) error (grandchild #22590 failed with exit status 127)
    
    
    backup script:
    Code:
    #!/bin/bash
    work_dir="/"
    bkup_dir="/media/external/"
    excl_dir="--exclude=/proc --exclude=/lost+found --exclude=/media/external --exclude=/mnt --exclude=/sys"
    date=`date +%Y%m%d`
    
    cd $work_dir
    
    tar cvpzf $bkup_dir/backup_$date.tgz $excl_dir $work_dir
    
    I try to change bin/bash to bin/sh but does not help. Permission to script is 750, permission to /media/external 755

    Where is a problem?

    Thank you.
     

Share This Page