cron not working.

Thread Tools Search this Thread
Operating Systems Solaris cron not working.
# 1  
Old 08-10-2009
cron not working.

I have a script

the path is /netmon/bin/

when i run this script as

sh /netmon/bin/ it runs completely fine.

but when i include it in crontab , it does not run

my cron entry is

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /netmon/bin/

(the script should run every 5 min)

i have also included the environment variables in the begining of my script

env >

after that also it is not working

I searched the forum , the solution to include profiles is suggested

can anyone tell me how to do that.

Please suggest me if anyone knows the solution for this.
# 2  
Old 08-10-2009
can you list the cronatb entry ? please execute crontab -l and see what you you get as output
# 3  
Old 08-10-2009

Why do you run the script manually as
sh /netmon/bin/

with sh? Is the file not executable? Can you check it?

To include your profile either source it in the cronjob or at the start of your script:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * . ~/.profile && /netmon/bin/

Also, if your cron supports it change

(because it looks nicer!)

To check:
man 5 crontab

# 4  
Old 08-10-2009
45 09 * * * su - oracle -c /oracle/oracle/bin/top_job >/dev/null
15 3 * * * find / -name .nfs\* -mtime +7 -exec rm -f {} \; -o -fstype nfs -prune
5 4 * * 6 /usr/lib/newsyslog >/dev/null 2>&1
15 4 * * * find /var/preserve/ -mtime +7 -a -exec rm -f {} \;

the above is my crontab entry

also the server is old and */5 does not work in it

also if anyone can show me how to include profiles with an example, it will greatly help.

I do not know much about profiles


---------- Post updated at 09:55 AM ---------- Previous update was at 09:52 AM ----------

sorry i included the profiles but its not working

my script is executable, i can directly use

and sorry scotn. I have seen the example given by you for profiles sorry for giving it . i missed on that . but that is also not working

please help


---------- Post updated at 09:56 AM ---------- Previous update was at 09:55 AM ----------

i have posted the entry
# 5  
Old 08-10-2009
45 09 * * * su - oracle -c /oracle/oracle/bin/top_job >/dev/null
15 3 * * * find / -name .nfs\* -mtime +7 -exec rm -f {} \; -o -fstype nfs -prune
5 4 * * 6 /usr/lib/newsyslog >/dev/null 2>&1
15 4 * * * find /var/preserve/ -mtime +7 -a -exec rm -f {} \;
and the script you are talking about is

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /netmon/bin/
no reference in crontab list !!!!!

Which means your job is not entered into the cronatb. please submit it with crontab -e and see what you get
# 6  
Old 08-10-2009
i wrote this entry first . but as this is a live server i removed it from the cron file

the entry was as it is in the cron file as i have mentioned

# 7  
Old 08-10-2009
I don't like the look of this line:

env >
It will enquire about the current environment and put the output into a file called in whichever directory is current at the time the command is issued (hopefully not the same directory as your script of that name). It will however be useful to compare the results of "env" from cron against "env" from the command prompt, paying particular attention to PATH.

If your cron runs there will be entries in the cron log (usually /usr/adm/cron/log).
If the cron runs and produces an untrapped error message the error message will be in the mail file for the user who owns the cron (which in this case looks like root).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. SuSE

Cron not working

Hi, It is SLES 10.3 VM. Suddenly cron stopped working on this and I am not able to figure out, where it is failing. It is not running with even root. I gave a simple job of redirection of 'date' command, that also doesn't work. Can somebody help me to fix this ? vmprdt23:~ # ps -ef | grep -i... (4 Replies)
Discussion started by: solaris_1977
4 Replies

2. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

3. Shell Programming and Scripting

cron job now working?

Hi all, I wrote a script as below, #!/bin/ksh . /app/home/etc/sudo.profile >/dev/null java -jar $HOME/abc.jar The jar file abc.jar is located in the same folder as the script. When I'm manually running that script the jar file gets executed. However if I set a cron job, it... (5 Replies)
Discussion started by: isaacniu
5 Replies

4. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

5. Shell Programming and Scripting

why isnt cron working?

I am using Ubuntu linux desktop, and I am trying to schedule a sheel script to run every 10minutes. These are the steps I have taken: crontab -e added and saved this line to the file # m h dom mon dow command */1 * * * * /home/enzo/Desktop/dlrecentuse restarted cron: sudo... (5 Replies)
Discussion started by: daydreamer
5 Replies

6. UNIX for Dummies Questions & Answers

Cron not working

I created a file in /u01/oradata directory as cronjb.ksh which contains following script 30 12 * * * /export/home/oracle/u01/oradata/rman.ksh '/export/home/oracle' is my root directory. I then moved cronjb.ksh file to my '/export/home/oracle' directory. i typed crontab cronjb.ksh. However my... (1 Reply)
Discussion started by: manna
1 Replies

7. HP-UX

Cron - Not working properly

Hi, I do have three scripts. Whcih inserts records into a table using sqlldr, creating some reprot files etc. The first script will call the second and then the second will call the third. When I run my first script from the shell prompt, all my operation are completed successfully. If I do... (23 Replies)
Discussion started by: risshanth
23 Replies

8. UNIX for Dummies Questions & Answers

Cron not working?

Hello I have a mac os x server machine that I have setup a cron to run a php file using wget and cron doesn't seem to work. I have setup cron on other mac's before and they have all worked. Also I know wget works because I have tested it. Is there anything else I should try? I do crontab -e and... (5 Replies)
Discussion started by: christo16
5 Replies

9. UNIX for Dummies Questions & Answers

cron not working

Cron does not seem to work with this crontab. Any ideas? # run-parts # commands to execute every hour 01 * * * * root run-parts /etc/cron.hourly # commands to execute every day 02 4 * * * root run-parts /etc/cron.daily # commands to execute every week 22 4 * * 0 root run-parts... (1 Reply)
Discussion started by: DaleCabell
1 Replies

10. UNIX for Dummies Questions & Answers

cron/crontab not working

Hello All! I'm having problems with cron. First cron is running as a process when i send the top command and I am logged in as root. I type crontab -e to edit/create my cron job. What I'm trying to do is run a perl script on my server (the script does work, i know because I type perl (2 Replies)
Discussion started by: ezekiel61
2 Replies
Login or Register to Ask a Question