The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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-12-2008 02:07 AM
How to use own account env variables to cron user Tlg13team HP-UX 3 01-28-2008 09:38 AM
CRON usage for CRON job skyineyes UNIX for Dummies Questions & Answers 1 01-17-2008 10:17 AM
AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log Keith Johnson AIX 0 01-09-2008 08:32 PM
What user runs cron? michieka UNIX for Dummies Questions & Answers 10 06-02-2002 11:32 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-04-2004
finster's Avatar
finster finster is offline
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
  #2 (permalink)  
Old 11-04-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
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).
  #3 (permalink)  
Old 11-04-2004
finster's Avatar
finster finster is offline
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 12:01 PM..
  #4 (permalink)  
Old 11-04-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
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.
  #5 (permalink)  
Old 11-04-2004
finster's Avatar
finster finster is offline
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
  #6 (permalink)  
Old 11-04-2004
A452917 A452917 is offline
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
  #7 (permalink)  
Old 11-05-2004
finster's Avatar
finster finster is offline
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-05-2004 at 02:35 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0