The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cron job starts new cron proccess ron76 SUN Solaris 3 05-11-2008 10:07 PM
How to use own account env variables to cron user Tlg13team HP-UX 3 01-28-2008 06:38 AM
CRON usage for CRON job skyineyes UNIX for Dummies Questions & Answers 1 01-17-2008 07:17 AM
AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log Keith Johnson AIX 0 01-09-2008 05:32 PM
What user runs cron? michieka UNIX for Dummies Questions & Answers 10 06-02-2002 07:32 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-04-2004
finster's Avatar
Registered User
 

Join Date: Nov 2002
Location: USA
Posts: 75
cron user

# cd /usr/lib/cron/
# ls
at.deny cron.deny FIFO logchecker queuedefs


I noticed I do not have a cron.allow file.

I have entries in the crontab file and users listed in the at.deny cron.deny files
# more at.deny
daemon
bin
smtp
nuucp
listen
nobody
noaccess

If I wanted to set a cron job, do I have to create a cron.allow file and how does it choose the user, by who submits thew job I suppose?

I have a script that is run by oracle user to create a backup that I would like to cron.

do I:
log in as oracle, edit crontab (crontab -e)
enter - 10 0 * * * /export/home/oracle/path_to_script/script.ksh

(run 00:10 am every night.)
then I'm done?

oracle owns the script.

or do I have to create a cron.allow file and add oracle to it?

Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 11-04-2004
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
If a cron.allow file is there, then only those listed in it can create a crontab. So you should be able to create a crontab file without it right now.

Quote:
do I:
log in as oracle, edit crontab (crontab -e)
enter - 10 0 * * * /export/home/oracle/path_to_script/script.ksh

(run 00:10 am every night.)
then I'm done?
Yes, you are done except to insure the script is set for executable by oracle, insure that no errors occur when run manually, insure no output is missed when running, insure if there is output where you are going to put it (maybe set up a log file for the nightly job to be checked or emailed). Also set your EDITOR or the default will be ed (which not as many folks use).
Reply With Quote
  #3  
Old 11-04-2004
finster's Avatar
Registered User
 

Join Date: Nov 2002
Location: USA
Posts: 75
How do I se it up so I can receive an email after execution?

If I normally run the script as oracle, then does that mean the script is set for executable by oracle?

I cannot open crontab -l as oracle and when I do a crontab -e it opens to vi.

Do I have to be root in order to submit a crontab? If I don't - how do I exit crontab, like I exit vi normally - (wq!)??

Thanks again.

Last edited by finster; 11-04-2004 at 09:01 AM.
Reply With Quote
  #4  
Old 11-04-2004
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Quote:
How do I se it up so I can receive an email after execution?
It matters what you are looking for - the entry you posted earlier would automatically send email to the oracle user if there was an error or any output - see the man page for crontab.

Quote:
If I normally run the script as oracle, then does that mean the script is set for executable by oracle?
If you can run the script as oracle, then the script is set for executable in some way to allow the oracle account to run it. It may be allowing the world to run it - simply look at the file with ls -l
Permissions will rwx or r-x. The userid that owns the file will be listed (may be oracle)
ls -l myscript
-rwx-r-xr-- 1 oracle dba 88 Nov 7 2003 myscript
This file is owned by oracle but allows execution by anyone in the dba group, by oracle (since it owns it) but only read for anyone else.

Quote:
I cannot open crontab -l as oracle and when I do a crontab -e it opens to vi.
You don't see anything with crontab -l because there is nothing there yet. Do the crontab -e and add this
* * * * * date > /tmp/oracle-test.date
Exit as you normally do from vi (saving the file wq). Then run crontab -l and you should see that entry.

Quote:
Do I have to be root in order to submit a crontab? If I don't - how do I exit crontab, like I exit vi normally - (wq!)??
Any user not listed in the cron.deny would be able to create a crontab. Yes, exit just like you normally do getting out of vi.
Reply With Quote
  #5  
Old 11-04-2004
finster's Avatar
Registered User
 

Join Date: Nov 2002
Location: USA
Posts: 75
bash-2.03$ crontab -e
0
* * * * * date > /tmp/oracle-test.date^[

Can't exit from line, when I hit the esc key(to go into command mode) I get ^[. If I hit enter I get a ?
on a new line.

Also what is the # "0" displayed after executing crontab -e?


When I do a crontab -e as root I get:
# crontab -e
482
Reply With Quote
  #6  
Old 11-04-2004
Registered User
 

Join Date: Nov 2004
Location: Mumbai, India
Posts: 14
It is because default editor is set to 'ed'. Change it to 'vi'

$PROPMT> export EDITOR=vi
Reply With Quote
  #7  
Old 11-04-2004
finster's Avatar
Registered User
 

Join Date: Nov 2002
Location: USA
Posts: 75
Crontab=
45 22 * * * /export/home/oracle/script.ksh

in /var/cron/log
> CMD: /export/home/oracle/script.ksh
> oracle 5235 c Thu Nov 4 22:45:00 2004
< oracle 5235 c Thu Nov 4 22:45:00 2004 rc=127

what does this rc=127 means. (rc=127 can't fork )
Path and filename is correct.
____________________________________
Checked my mail:
Your "cron" job on server1
/export/home/oracle/script.ksh

produced the following output:

/export/home/oracle/script.ksh[11]: exp: not found
_________________________________________

job didn't run.

help.


When I run it manually I cd to directory and type ./script.ksh and it works.

I tried crontab:
45 22 * * * cd /export/home/oracle;./script.ksh

with same results.

I am guessing that I may need to source my env, if exp is not found? (script uses exp to backup tables)

What's the best way to proceed and is this correct?



Last edited by finster; 11-04-2004 at 11:35 PM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0