Cron nao executa script

1. Cron nao executa script

WILLIAN VITOR DO AMOR
willsazon

(usa Ubuntu)

Enviado em 24/11/2015 - 13:38h

Boa tarde a todos,

possuo um servidor de banco de dados firebird, rodando Firebird Classic 2.1.3.
Esse servidor possui 2 base de dados. Eu tenho um script que eu programei para fazer backup da base de dados em um hd externo.

Esse script parou de funcionar de um tempo para ca. Rodei ele na unha e ele funcionou certinho.

Coloquei no cron e não vai.

Arquivo de log do Cron.
Nov  5 07:00:01 Banco CRON[16023]: (root) CMD (   /home/grupo/scripts/Salva_Banco &)
Nov 5 07:17:02 Banco CRON[16050]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 5 08:17:01 Banco CRON[16132]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 5 09:17:01 Banco CRON[16210]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 5 10:17:01 Banco CRON[16290]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 5 13:08:40 Banco cron[1051]: (CRON) INFO (pidfile fd = 3)
Nov 5 13:08:40 Banco cron[1097]: (CRON) STARTUP (fork ok)
Nov 5 13:08:40 Banco cron[1097]: (CRON) INFO (Running @reboot jobs)
Nov 8 00:57:02 Banco CRON[6293]: (root) CMD (if [ -x /usr/share/mdadm/checkarray ] && [ $(date +%d) -le 7 ]; then /usr/share/mdadm/checkarray --cron --all --idle --quiet; fi)
Nov 15 00:57:02 Banco CRON[19316]: (root) CMD (if [ -x /usr/share/mdadm/checkarray ] && [ $(date +%d) -le 7 ]; then /usr/share/mdadm/checkarray --cron --all --idle --quiet; fi)
Nov 20 13:06:07 Banco cron[1075]: (CRON) INFO (pidfile fd = 3)
Nov 20 13:06:07 Banco cron[1103]: (CRON) STARTUP (fork ok)
Nov 20 13:06:08 Banco cron[1103]: (CRON) INFO (Running @reboot jobs)
Nov 20 13:16:55 Banco cron[1074]: (CRON) INFO (pidfile fd = 3)
Nov 20 13:16:55 Banco cron[1109]: (CRON) STARTUP (fork ok)
Nov 20 13:16:55 Banco cron[1109]: (CRON) INFO (Running @reboot jobs)
Nov 20 13:51:30 Banco cron[1063]: (CRON) INFO (pidfile fd = 3)
Nov 20 13:51:30 Banco cron[1104]: (CRON) STARTUP (fork ok)
Nov 20 13:51:30 Banco cron[1104]: (CRON) INFO (Running @reboot jobs)
Nov 20 14:17:19 Banco cron[1017]: (CRON) INFO (pidfile fd = 3)
Nov 20 14:17:19 Banco cron[1049]: (CRON) STARTUP (fork ok)
Nov 20 14:17:19 Banco cron[1049]: (CRON) INFO (Running @reboot jobs)
Nov 21 16:20:18 Banco cron[1030]: (CRON) INFO (pidfile fd = 3)
Nov 21 16:20:18 Banco cron[1056]: (CRON) STARTUP (fork ok)
Nov 21 16:20:18 Banco cron[1056]: (CRON) INFO (Running @reboot jobs)
Nov 22 00:57:01 Banco CRON[2939]: (root) CMD (if [ -x /usr/share/mdadm/checkarray ] && [ $(date +%d) -le 7 ]; then /usr/share/mdadm/checkarray --cron --all --idle --quiet; fi)
Nov 23 16:00:47 Banco cron[7767]: (CRON) INFO (pidfile fd = 3)
Nov 23 16:00:47 Banco cron[7768]: (CRON) STARTUP (fork ok)
Nov 23 16:00:48 Banco cron[7768]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Nov 23 17:09:41 Banco cron[9548]: (CRON) INFO (pidfile fd = 3)
Nov 23 17:09:41 Banco cron[9549]: (CRON) STARTUP (fork ok)
Nov 23 17:09:41 Banco cron[9549]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Nov 24 09:33:38 Banco cron[13434]: (CRON) INFO (pidfile fd = 3)
Nov 24 09:33:38 Banco cron[13435]: (CRON) STARTUP (fork ok)
Nov 24 09:33:38 Banco cron[13435]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Nov 24 10:01:01 Banco CRON[13642]: (root) CMD ( /home/grupo/scripts/Salva_Banco /home/grupo/backup.log )
Nov 24 10:01:12 Banco CRON[13641]: (CRON) info (No MTA installed, discarding output)
Nov 24 10:02:01 Banco CRON[13660]: (root) CMD ( /home/grupo/scripts/Salva_Banco /home/grupo/backup.log )
Nov 24 10:02:21 Banco CRON[13659]: (CRON) info (No MTA installed, discarding output)
Nov 24 10:07:48 Banco cron[13698]: (CRON) DEATH (can't lock /var/run/crond.pid, otherpid may be 13435: Resource temporarily unavailable)
Nov 24 10:09:04 Banco cron[13720]: (CRON) INFO (pidfile fd = 3)
Nov 24 10:09:04 Banco cron[13721]: (CRON) STARTUP (fork ok)
Nov 24 10:09:04 Banco cron[13721]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Nov 24 10:15:01 Banco CRON[13745]: (root) CMD ( /home/grupo/scripts/Salva_Banco /home/grupo/backup.log )
Nov 24 10:17:01 Banco CRON[13765]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Nov 24 10:18:05 Banco CRON[13744]: (CRON) info (No MTA installed, discarding output)
Nov 24 10:30:01 Banco CRON[13884]: (root) CMD (/home/grupo/scripts/Salva_Banco)
Nov 24 10:30:45 Banco CRON[13883]: (CRON) info (No MTA installed, discarding output)
Nov 24 10:38:01 Banco CRON[13982]: (root) CMD (/home/grupo/scripts/Salva_Banco /home/grupo/backup.log)
Nov 24 10:38:59 Banco CRON[13981]: (CRON) info (No MTA installed, discarding output)
Nov 24 10:45:01 Banco CRON[14049]: (root) CMD (/home/grupo/scripts/Salva_Banco /home/grupo/backup.log)
Nov 24 10:46:12 Banco CRON[14048]: (CRON) info (No MTA installed, discarding output)
Nov 24 11:00:01 Banco CRON[14147]: (root) CMD (/home/grupo/scripts/Salva_Banco /home/grupo/backup.log)
Nov 24 11:05:44 Banco CRON[14146]: (CRON) info (No MTA installed, discarding output)
Nov 24 11:10:01 Banco CRON[14238]: (root) CMD (/home/grupo/scripts/Salva_Banco >> /home/grupo/backup.log)
Nov 24 11:10:49 Banco CRON[14237]: (CRON) info (No MTA installed, discarding output)
Nov 24 11:20:01 Banco CRON[14364]: (root) CMD (/home/grupo/scripts/Salva_Banco >> /home/grupo/backup.log)
Nov 24 11:26:57 Banco CRON[14363]: (CRON) info (No MTA installed, discarding output)
Nov 24 13:14:24 Banco cron[14827]: (CRON) DEATH (can't lock /var/run/crond.pid, otherpid may be 13721: Resource temporarily unavailable)
Nov 24 13:14:55 Banco cron[14855]: (CRON) DEATH (can't lock /var/run/crond.pid, otherpid may be 13721: Resource temporarily unavailable)


Meu arquivo de configuração do cron.

# /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/sh
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 )

#######################################################################################################
#Executa o script de backup que salva o banco no HD EXTERNO
#######################################################################################################
00 07 * * * root /home/grupo/scripts/Salva_Banco
10 13 * * * root /home/grupo/scripts/Salva_Banco /home/grupo/backup.log
00 12 * * * root /home/grupo/scripts/Salva_Banco
00 19 * * * root /home/grupo/scripts/Salva_Banco
#
#######################################################################################################
#Executa o script do backup-manager que faz backup full no site da amazon
######################################################################################################
30 04 * * * root bash /home/grupo/scripts/backup_manager.sh
#





  


2. res:Cron-nao-executa

marcio mendes mendes
conectadohost

(usa XUbuntu)

Enviado em 24/11/2015 - 15:10h

Olá,
tenta coloca isso antes de tudo

#!/bin/bash
SHELL=/bin/sh
PATH=/sbin:/usr/sbin:/usr/bin:/bin

e não dessa forma
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Outra coisa que reparei é que você usa os cron.daily, weekly, monthly

eu sempre utilizo o crontab -e
quando quero executar somente em um dia do mês programo direto no cron
tipo só dia 15 00 00 15 * * /bin/script
compreende onde quero chegar.




---> A arte de programar consiste na arte de organizar e dominar a complexidade.
---> Dijkstra <---


3. Re: Cron nao executa script

WILLIAN VITOR DO AMOR
willsazon

(usa Ubuntu)

Enviado em 24/11/2015 - 17:41h

conectadohost escreveu:

Olá,
tenta coloca isso antes de tudo

#!/bin/bash
SHELL=/bin/sh
PATH=/sbin:/usr/sbin:/usr/bin:/bin

e não dessa forma
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

Outra coisa que reparei é que você usa os cron.daily, weekly, monthly

eu sempre utilizo o crontab -e
quando quero executar somente em um dia do mês programo direto no cron
tipo só dia 15 00 00 15 * * /bin/script
compreende onde quero chegar.




---> A arte de programar consiste na arte de organizar e dominar a complexidade.
---> Dijkstra <---


Ola amigo,

Boa tarde.
Obrigado por responder ao meu topico.
Eu estava olhando os logs com mais calma e vi a mensagem /var/run/cron.pid.

Eu exclui esse arquivo e aparentemente esta funcionando. Vou fazer uns teste para ver se funciona mesmo.









Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts