Home » Infrastructure » Linux » Cron job is not executing on time
Cron job is not executing on time [message #186047] Sat, 05 August 2006 03:37 Go to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

I have crated the shall script and assing executable permition to file, when i am running from command prompt its working fine.
I have link this file with crontab but its not exeuting on said time.
#/bin/sh
# exporting user schema
${ORACLE_HOME}/bin/
exp orion10new/orion11new file=/oraback/ktcoribk.dmp full=N log=/oraback/backup.log

crontab -e

30 0 * * * oracle /home/oracle/backup.sh

kindly help on this post

Regards
Re: Cron job is not executing on time [message #186059 is a reply to message #186047] Sat, 05 August 2006 08:45 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
1) Line #1 in script does nothing or generates an err.
2) It appears you crontab entries is broken/incorrect.
3) I suspect you need to learn about sourcing in appropraite environemt.
Re: Cron job is not executing on time [message #186060 is a reply to message #186059] Sat, 05 August 2006 08:59 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

If you have any idea please give some tips on this
Re: Cron job is not executing on time [message #186061 is a reply to message #186047] Sat, 05 August 2006 09:04 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Post results from
crontab -l
Try reading the fine man pages
man 5 crontab
Re: Cron job is not executing on time [message #186064 is a reply to message #186061] Sat, 05 August 2006 09:08 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

Crontab result as follows

[oracle@KHAMISDB oracle]$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.1013 installed on Thu Aug 3 09:46:27 2006)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
30 0 * * * oracle /home/oracle/backup.sh
[oracle@KHAMISDB oracle]$

Thanks lot, i have read cron man page still i am not clear
Re: Cron job is not executing on time [message #186066 is a reply to message #186047] Sat, 05 August 2006 09:16 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>30 0 * * * oracle /home/oracle/backup.sh
What in the world is "oracle " supposed to do in the line above?
"The ''sixth'' field (the rest of the line) specifies the command to be run."

[Updated on: Sat, 05 August 2006 09:18] by Moderator

Report message to a moderator

Re: Cron job is not executing on time [message #186067 is a reply to message #186066] Sat, 05 August 2006 09:19 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

30 0 * * * oracle /home/oracle/backup.sh

Oracle is the user and the path of the file to execute in home/oracle
Thanks
Re: Cron job is not executing on time [message #186068 is a reply to message #186047] Sat, 05 August 2006 09:30 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
> i have read cron man page
Please cut & paste from the man page where it states the username is to be included in the cron entry?
Re: Cron job is not executing on time [message #186069 is a reply to message #186068] Sat, 05 August 2006 09:34 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

No I have read this in google saying crontab -u, other root if ur executing cron job you have add user name its in the article so i add even tho its not executing with user or with out user. is there any thing to do with file permision?

Thanks lot for your reply



Re: Cron job is not executing on time [message #186071 is a reply to message #186069] Sat, 05 August 2006 09:37 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

[oracle@KHAMISDB oraback]$ man 1 crontab
CRONTAB(1) CRONTAB(1)

NAME
crontab - maintain crontab files for individual users (V3)

SYNOPSIS
crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }

DESCRIPTION
Crontab is the program used to install, deinstall or list the tables
used to drive the cron(Cool daemon in Vixie Cron. Each user can have
their own crontab, and though these are files in /var, they are not
intended to be edited directly.

If the allow file exists, then you must be listed therein in order to
be allowed to use this command. If the allow file does not exist but
the deny file does exist, then you must not be listed in the deny file
in order to use this command. If neither of these files exists, then
depending on site-dependent configuration parameters, only the super
user will be allowed to use this command, or all users will be able to
use this command.

If the -u option is given, it specifies the name of the user whose
crontab is to be tweaked. If this option is not given, crontab exam-
ines "your" crontab, i.e., the crontab of the person executing the com-
mand. Note that su(Cool can confuse crontab and that if you are running
inside of su(Cool you should always use the -u option for safetyΓÇÖs sake.
Re: Cron job is not executing on time [message #186074 is a reply to message #186047] Sat, 05 August 2006 09:45 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Your previous post involves invoking crontab.
It say NOTHING about the format of the actual cron entry.
man 5 crontab
Please cut & paste from the man page where it states the username is to be included in the cron entry?
Here is a free clue...
"oracle " should NOT be included!
Re: Cron job is not executing on time [message #186075 is a reply to message #186074] Sat, 05 August 2006 09:50 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

man 5 Crontab its not saying any thing about the user.

cron job can execute any users or only root?

Thanks
Re: Cron job is not executing on time [message #186076 is a reply to message #186047] Sat, 05 August 2006 09:54 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>cron job can execute any users
Yes, any user can use cron (if not in cron.deny).
Re: Cron job is not executing on time [message #186077 is a reply to message #186047] Sat, 05 August 2006 10:03 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
make the following crontab entry
* * * * * date > /tmp/date.lis
* * * * * env > /tmp/user.env
Re: Cron job is not executing on time [message #186080 is a reply to message #186077] Sat, 05 August 2006 10:20 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

i have done the same
[oracle@KHAMISDB oracle]$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.8507 installed on Sat Aug 5 19:14:54 2006)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
30 0 * * * /home/oracle/backup.sh
* * * * * date > /tmp/date.lis
* * * * * env > /tmp/user.env

what it will do above script

Thanks
Re: Cron job is not executing on time [message #186081 is a reply to message #186080] Sat, 05 August 2006 10:23 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

I have check the /tmp
and its genererating 2 file

[oracle@KHAMISDB tmp]$ cat user.env
SHELL=/bin/sh
PATH=/usr/bin:/bin
PWD=/home/oracle
SHLVL=1
HOME=/home/oracle
LOGNAME=oracle
_=/usr/bin/env

[oracle@KHAMISDB tmp]$ cat date.lis
Sat Aug 5 19:19:00 GST 2006
Re: Cron job is not executing on time [message #186082 is a reply to message #186081] Sat, 05 August 2006 10:26 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

I have one more question can i directly type the exp command insted of calling backup.sh file?
Re: Cron job is not executing on time [message #186083 is a reply to message #186047] Sat, 05 August 2006 10:38 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
If it is your system, you can do anything you want to do.
from your command line do:
env > /tmp/ktcit.env
diff /tmp/ktcit.env /tmp/user.env
Re: Cron job is not executing on time [message #186084 is a reply to message #186083] Sat, 05 August 2006 10:50 Go to previous messageGo to next message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

I hace check its showing lot of diff.. in both file
here i am attaching the file

Thanks
  • Attachment: ktc.zip
    (Size: 0.91KB, Downloaded 1702 times)
Re: Cron job is not executing on time [message #186142 is a reply to message #186084] Sun, 06 August 2006 07:22 Go to previous message
ktcit
Messages: 24
Registered: August 2006
Location: OMAN
Junior Member

how we can check while executing cron job which env setting chekcing, pls help
Previous Topic: cannot apply the patch into linux ES release 3
Next Topic: Net configuration assistant hang while Installation
Goto Forum:
  


Current Time: Tue Dec 03 07:34:04 CST 2024