Hi Satish:
Your last question: how can we capture the output of the cronjob.
Use the directional parameters "> $file" and/or ">> $file" for example. Anything that goes to stdout would then be routed to $file. Any other stdoutput would, for example go into the mail of the user who has called the crontab-job.
Try something like this:
Code:
10 4 * * * . ~/.bashrc; ${SCRIPTS}/backup_mysql.sh >> ${BACKUPS_LOG}/${HOSTNAME}_mysql_v${VERS}.script.log 2>&1
My practice is to get output from the specific functions in the program to output to log files. For example the program "./backup_mysql.sh" may generate files that are of interest to specific users.
Above the redirection is to a log-file describing the overall performance of the program and the variable used by "./backup_mysql.sh". This logs data that would be of interest to the administrator, for example.
Note: "2>&1" is also a redirection. Another story!
regards
GrahamB