+ Responder ao Tópico



  1. #1

    Padrão Script no CRON não roda completamente

    Bom dia pessoal, tenho um script de backup que roda normalmente manualmente, porém quando jogo no cron, o mesmo começa e para logo após ter backupeado somente 30M por exemplo, abaixo segue o script de backup e o cron e os arquivos.

    #!/bin/bash
    fecha=`date +"%d-%m-%Y"`

    # Backup and gzip the directory
    sudo tar -cvzpf /var/backups/backup/backup-$fecha.tgz --same-owner --exclude="/export/*" --exclude="/var/backups/backup/*" --exclude="/var/backups/backup/error.log" --exclude="/proc/*" --exclude="/media/*" --exclude="/dev/*" --exclude="/mnt/*" --exclude="/sys/*" --exclude="/tmp/*" / 2>/var/backups/backup/error.log
    # Rotate the logs, delete older than 7 days
    find /var/backups/backup/ -mtime +7 -exec rm {} \;

    _____________________________________________________

    # /etc/crontab: system-wide crontab
    # Unlike any other crontab you don't have to run the `crontab'
    # command to install the new version when you edit this file
    # and files in /etc/cron.d. These files also have username fields,
    # that none of the other crontabs do.

    SHELL=/bin/bash
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

    # m h dom mon dow user command
    17 * * * * root cd / && run-parts --report /etc/cron.hourly
    25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    #
    02 10 * * * root /usr/bin/backup.sh

    __________________________________________________________

    -rw-r--r-- 1 root root 476 2010-08-25 17:25 2010-08-25_backup.log
    -rw-r--r-- 1 root root 1.4G 2010-08-25 17:25 backup-25-08-2010.tgz
    -rw-r--r-- 1 root root 30M 2010-08-27 10:02 backup-27-08-2010.tgz
    -rw-r--r-- 1 root root 44 2010-08-27 10:02 error.log

    ___________________________________________________________


    Alguem tem alguma ideia?

    Obrigado

    Neto

  2. #2

    Padrão Re: Script no CRON não roda completamente

    Nao me pergunte pq mas a unica maneira que funciona eh desviando para tty

    Ex
    0 6 * * * root Script > /dev/tty1

  3. #3

    Thumbs up Re: Script no CRON não roda completamente

    E não eh que funciona mesmo!!!

    Valew pela dica laerciomotta vou pesquisar o porque!


    Neto