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:
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.
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!!!
You got more possibilities to read the output of the cron-script:
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”).
You can redirect the output of the cron-script into a logfile. So cron doesn’t send any mails. It works like that:
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
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: