LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   crontab with shell (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-with-shell-935114/)

S@R@H 03-18-2012 11:42 AM

crontab with shell
 
hi all
i am using oracle enterprise linux 5.5, i tried alot to use crontab but unfortunatly did not solve my problem and also search on the net
i want to run the shell script and my crontab is something like this.

!/bin/sh
SHELL=/bin/sh
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
HOME=/home/orale
LOGNAME=oracle
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/usr/bin
22 12 * * * cd /home/oracle/sh rman.sh >> /u01/rman.log



plz if anyone knows about crontab so plz help me out..thanks in advance.

nicolasdiogo 03-18-2012 12:33 PM

i find crontab confusing too - and i am not alone.

i am sure you have done your research but you can have look at this website:
http://www.notesbit.com/index.php/sc...nix-and-linux/

and consider installing something like webmin:
www.webmin.com

if you find these admin tasks too confusing.

Nicolas

ochienged 03-18-2012 03:56 PM

Hi S@R@H, your post leaves a lot to be asked. For instance, what should the script accomplish? Assuming that your script, which is to be run by cron is comprehensive, my approach would be:
  1. To have everything in a script including the output redirection to file
  2. Alternatively, rather than cd to directory containing script, use the full path e.g. /home/oracle/sh/rman.sh >> /u01/rman.log

I think the major caveat is that you do not have command seperation. Maybe introducing a colon or preferably '&&' between the directory /home/oracle/sh and you script may help. It will also be great if you try your scripts on the commandline before adding them to cron.

chrism01 03-18-2012 06:02 PM

Also see http://www.adminschoice.com/crontab-quick-reference.

You can have only one active definition of a var eg SHELL, in the file. If you have more, the last/latest will be the one that takes effect.


All times are GMT -5. The time now is 04:38 PM.