Geller
November 17, 2008, 4:21pm
1
hello all,
I have a shell script and I need to schedule it in crontab, I have the next line:
06 16 * * 1,2,3,4,5 /usr/bin/ksh /path/path/name.sh > /path/path/name.log
first, I scheduled from Monday to Friday but it doesn't run, the log file is empty.. any idea why is causing this?
note: my shell works if I run it manually.
Thanks!
Geller
November 17, 2008, 5:01pm
3
could you explain me crond?, I am new on this and I haven't heard about crond, how can I check if crond is running? thank you
Ikon
November 17, 2008, 5:17pm
4
crond is the service that runs the cronjobs. If its not running your jobs wont run either.
What OS you using?
Post output of:
# ps aux | grep crond
Geller
November 17, 2008, 5:23pm
5
SunOS 5.8 Generic_117350-35 sun4u sparc SUNW,Netra-T12
$ ps aux | grep crond
usage: ps [ -aAdeflcjLPy ] [ -o format ] [ -t termlist ]
[ -u userlist ] [ -U userlist ] [ -G grouplist ]
[ -p proclist ] [ -g pgrplist ] [ -s sidlist ]
'format' is one or more of:
user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid
pri opri pcpu pmem vsz rss osz nice class time etime stime
f s c lwp nlwp psr tty addr wchan fname comm args projid project
Ikon
November 17, 2008, 5:40pm
6
Ok, Im not sure of the command in SunOS.
you need to figure out how to the the ps command
This is what works on HP-UX:
# ps -ef | grep crond
But not sure if thats correct on SunOS
Geller
November 17, 2008, 5:47pm
7
I tried the last command and I got this:
$ ps -ef | grep crond
user 19096 7926 0 17:44:58 pts/4 0:00 grep crond
Ikon
November 17, 2008, 5:53pm
8
OK, that shows crond is NOT running.
also try (on HP-UX its cron vs crond):
# ps -ef | grep cron
Lookup how to start crond.
might be:
# /etc/init.d/cron start
Find your init.d directory and look for cron or crond
Geller
November 17, 2008, 6:00pm
9
but my user is not root, does it matter?, I have another user and It seems that I do not have privileges:
$ cron start
! you are not authorized to use cron. Sorry. Mon Nov 17 17:57:32 2008
! ******* CRON ABORTED ******** Mon Nov 17 17:57:32 2008
Ikon
November 17, 2008, 6:02pm
10
Yes you must have root access.
Geller
November 17, 2008, 6:05pm
11
other thing, I did a test with a simple shell script like: touch TEST that comand I put in a file .sh I scheduled in crontab and the file TEST was created. I don't know why with my other shell script the cron is not working. =/
Geller
November 17, 2008, 11:52pm
12
do you have other suggestion? thanks.
Ikon
November 18, 2008, 7:18am
13
Well it appears that cron IS running.
Check the cron logfile, if you have permission. Since you are not root ask your sysadmin for help.
Geller
November 18, 2008, 11:51am
14
Yes, I have permission, my user appears at at.allow file.
Any idea?
Geller
November 19, 2008, 3:14pm
15
my crontab has been executed successfully, I had to add this line:
export PATH=$PATH:$ORACLE_HOME/bin
to my shell script.
Note: My shell was running a sql script.
Thanks.