LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-18-2012, 12:42 PM   #1
S@R@H
Member
 
Registered: Apr 2010
Posts: 40

Rep: Reputation: 0
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.
 
Old 03-18-2012, 01:33 PM   #2
nicolasdiogo
Member
 
Registered: Oct 2003
Location: UK
Distribution: debian lenny x64
Posts: 130

Rep: Reputation: 20
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
 
Old 03-18-2012, 04:56 PM   #3
ochienged
Member
 
Registered: Oct 2007
Location: Plano, TX
Distribution: Fedora, CentOS, RHEL, Debian
Posts: 70

Rep: Reputation: 26
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.
 
Old 03-18-2012, 07:02 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script Not Working with crontab Ankush Raj Linux - Newbie 3 10-17-2011 12:10 PM
Shell Script not Running from Crontab venkatramanj SUSE / openSUSE 3 01-13-2010 06:15 AM
Crontab/Shell Output problem mdx34 Linux - Newbie 5 09-12-2008 05:31 PM
how to run crontab in shell script panselva Linux - General 3 05-08-2008 09:33 PM
crontab job and run on shell sunhui Linux - Software 1 02-13-2007 06:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration