Run automatic ADABCK using CRON

Hello,
I would like to know how can active an shell script to start an ADABCK backup using CRONTAB tools.
I already test the shell script backup in manual way so I want to start it using the CRON. Apparently, the shell script was started but it could not run for any reason because I could not see the backup dataset neither the execution report.
I already done the following test:

  1. Defining a CRONTAB shell into the user directory with the following specifications: 15 20 * * *

If you are using the $SAG environment variable, check to be sure that the $SAG variable has a value, or… hard code the path name to the script and ‘source’ the sagenv file inside the script

Hello James,
I just specify the assign.bsh and the $SAG variable inside the shell but I do not specify the sagenv. Let me insert the ‘source’ sagenv and test it.

Thanks a lot

Hello James,
The test was not successful. Attach you will see the backup shell script. The shell script permisology is -rwxr-xr-x root root 730 2008-11-18 03:35 respaldaBD.sh. It is in the following path /etc/cron-hourly.
What else I could do? I really appreciate what ever you can do to help me!!!

Best Regards
respaldaBD.txt (756 Bytes)

Are you receiving any messages in the log files?

No the file is empty

What is the operating system?

Have you tried cron with any other scripts?

You may also wish to check for any email sent to the cron user (root?) for any messages

Hi James,
The Operating System is SuSe Enterprise Server 9.

No I haven

Hello Osman Sanchez!

You got more possibilities to read the output of the cron-script:

  1. As James Gilpin wrote: Check your mails. You can do this by typing “mail” on the command line. (For more information about this interactive program please type “man mail”).
  2. You can redirect the output of the cron-script into a logfile. So cron doesn’t send any mails. It works like that:
SAG=/path/to/sag
15 20 * * * $SAG/Procesos/respaldaBD.sh >/path/logfile.log 2>&1

Please note that you have to tell the crontab the content of $SAG.

Thanks a lot Matthias I’ll keep you informed

Hello Mathias,
Finally, I could check the mails and I’ve read 2 messages:
.- The first one is: /bin/sh: line 1: /opt/softwareag/Reportes/respaldo.log: Permission denied; when I used the output redirectioning.

.- The second one is: /bin/sh: line 1: sag: command not found; without the output redicrectioning

I think the line 1 reported belongs to the crontab, isn’t it?

Hello Matthias,
I’ve got a good news. I find out in the mails a message related to a commad not found and the command that it report is sag but sag is not a command it is the user that execute the cron. I modified the crontab line 1 suppressing the user sag and now it runs successfully.
The crontab entry inside the sag user’s session before the modification is: 21 03 * * * sag /opt/softwareag/Procesos/respaldaBD.sh > /opt/softwareag/Reportes/respaldo.log

The crontab entry inside the sag user’s session after the modification is:
46 03 * * * /opt/softwareag/Procesos/respaldaBD.sh > /opt/softwareag/Reportes/respaldo.log

The second one is the entry that works ok

Thanks a lot for your help

Cheers

Only the system crontab file (i.e. /etc/crontab) has the possibility to set a login. But I wouldn’t change this crontab. I would take the user’s crontab file - and every user has it’s own crontab…

The operator “>” redirects the standard-output (stdout) only - but not the standard error output (stderr). Usually, you want to see both together in one logfile. Then you have to code:

command > file 2>&1 

For more information:
http://en.wikipedia.org/wiki/Redirection_(computing)