cron user


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cron user
# 1  
Old 11-04-2004
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  
Old 11-04-2004
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  
Old 11-04-2004
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  
Old 11-04-2004
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  
Old 11-04-2004
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  
Old 11-04-2004
It is because default editor is set to 'ed'. Change it to 'vi'

$PROPMT> export EDITOR=vi
# 7  
Old 11-05-2004
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..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Is CRON only for root user

Hi, i have question about cron. can we have user based cron file under /var/spool/cron or we should have only root file which can only be accessed by root user or admin and he should only be doing the task of scheduling. PKS (8 Replies)
Discussion started by: praveenkumar198
8 Replies

2. Shell Programming and Scripting

Cron Job for Fake User

There is a program that we (a company I'm working for) would like to run once per day, and the approach we're taking is to create a fake user to give a location to the data for this program, and to be the user running the program. For the sake of the discussion, let me call the fake user "bob". ... (5 Replies)
Discussion started by: stevendaryl
5 Replies

3. Solaris

! bad user (adm).. in cron log

I have noticed this error in /var/cron/log: > CMD: /usr/lib/acct/ckpacct > adm 6739 c Tue Oct 11 10:00:00 2011 < adm 6739 c Tue Oct 11 10:00:00 2011 rc=1 ! bad user (adm) Tue Oct 11 11:00:00 2011but when I try to list crontab of user 'adm': solarni/~# crontab -l adm crontab: you are... (4 Replies)
Discussion started by: orange47
4 Replies

4. Shell Programming and Scripting

Does running a cron job of a user require the user to be logged in?

Suppose user 'asdf' is not logged into server 'bbbb', but the server is up. User 'asdf' has cron job. Will it be executed? (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

5. Solaris

Is user cron job running in background?

Hi, Should the user jobs specified in crontab be running in background? Cron daemon is already running in background. So I am not sure whether should the jobs (output and error messages are redirected to file) ran by it be explicitly stated to be run in background (& at end of command) if one... (1 Reply)
Discussion started by: joe_x
1 Replies

6. Solaris

User entry in both cron.allow and cron.deny

Hello All, Anybody please help me to know ,what happens when a user having entry in both cron.allow and cron.deny files.Wheather the user will be able to access the crontab??? Thanks in advance Vaisakh (5 Replies)
Discussion started by: ksvaisakh
5 Replies

7. HP-UX

Create a user Specfic CRON

Hi there, I have a small script that I need to run every hour and would like to schedule this a a cron job. I have tried running it in root but due to elm not being setup and file permissions it does not work unless it is ran from a specfic account. Is it possible to setup a user cron and how... (5 Replies)
Discussion started by: lodey
5 Replies

8. Shell Programming and Scripting

adding a user to cron.allow

Hello all, I have solaris 10. I have have a script that installs crontab for a user. I want to add some more features to this script. I want to check whether the user exists in etc/cron.d/cron.allow ... if yes then continue the script without adding .... if not, then add that user to the... (6 Replies)
Discussion started by: MisterKhan
6 Replies

9. HP-UX

How to use own account env variables to cron user

hi all, i have one account for unix Tru64. i can login this account and i do execute special shell script(login sqlplus, execute another shell, etc... ) on this account on my server. but i can't run this shell from cron tab. i think that become cron user envirnoment variables. (3 Replies)
Discussion started by: Tlg13team
3 Replies

10. UNIX for Dummies Questions & Answers

What user runs cron?

I have a command that is found in /usr/ud51/bin called stopudt which safely stops idle database users (let's writes finish, etc). If I login as root and issue stopudt the process is stopped. I put a script in cron to run it and it says stopudt not found. /usr/ud51/bin is in root's PATH. ... (10 Replies)
Discussion started by: michieka
10 Replies
Login or Register to Ask a Question