Another Cron issue.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Another Cron issue.
# 1  
Old 03-13-2008
Another Cron issue.

Hey guys,

I have a script called my_test:
Code:
# !/usr/bin/sh
`touch /usr/test/me`

The script has been saved in /usr/test/my_test
I have executed chmod 755 /usr/test/my_test
Then I have entered it into the cron file using crontab -e
Code:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/test/my_test > /usr/test/mytestlog

I was hoping that the script would be executed every 5 minutes, the file /usr/test/me would be timestamped with the last touch and the last touch would be logged in /usr/test/mytestlog.

What I am finding, every 5 minutes the mytestlog has been created, (timestamped when the cron last fired.) but the /usr/test/me file hasn't been timestamped and the log file is empty.

To me, it looks like the cron is firing, but the script hasn't executed. It executes manually but not from the cron. The script was created by root, the cron was created by root, its displayed in the cron when I type
Code:
crontab -l

and it looks like it has fired without error in the /var/cron/log file.

Can anyone shed any light on how I can track down this problem.

Thanks in advance.

Added: Its on a sun box.

Last edited by Beefy; 03-13-2008 at 12:58 PM.. Reason: More information
# 2  
Old 03-13-2008
Just tested since I couldnt see what was wrong...
I created a /sm/test dir...(chmod 777...)
And well in my context it works...
ant:/sm/test $ date
Thu Mar 13 18:20:33 MET 2008
ant:/sm/test $ ll
total 2
-rw-rw-rw- 1 vbe bin 0 Mar 13 18:20 me
-rwxrwxr-x 1 vbe bin 35 Mar 13 18:14 my_test
-rw-r--r-- 1 root sys 0 Mar 13 18:20 mytest.log
ant:/sm/test $ date
Thu Mar 13 18:21:32 MET 2008
ant:/sm/test $ ll
total 2
-rw-rw-rw- 1 vbe bin 0 Mar 13 18:22 me
-rwxrwxr-x 1 vbe bin 35 Mar 13 18:14 my_test
-rw-r--r-- 1 root sys 0 Mar 13 18:22 mytest.log
ant:/sm/test $ ll
total 2
-rw-rw-rw- 1 vbe bin 0 Mar 13 18:22 me
-rwxrwxr-x 1 vbe bin 35 Mar 13 18:14 my_test
-rw-r--r-- 1 root sys 0 Mar 13 18:22 mytest.log
ant:/sm/test $
So you may have to say a bit more...
(Here this is an HP9000/rp5450 box running hpux11.11)
# 3  
Old 03-13-2008
forgot to add:
/usr/test/my_test > /usr/test/mytestlog 2>&1 # I would add if you suspect some error and want to see...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron issue

i have written a script to sftp yesterday's logs from another server as below: cd /export/home/abc/xyz/tt d=`gdate -d'yesterday' +%Y%m%d` sftp abc@XXX.XX.XX.XX<<EOF cd /yyy/logs/archive mget abc.log.$d* EOF cd /export/home/abc/xyz/scripts nohup ./ss.sh PROD & it is working fine... (2 Replies)
Discussion started by: ssk250
2 Replies

2. Solaris

CRON Issue

Hello, I am running Solaris 8. I have set a cron job that runs every couple hours. If I run the script manually, it runs just fine (logged in as root). The cron however will not run. It is producing an rc=1 error. Any thoughts would be appreciated. Thanks (4 Replies)
Discussion started by: jkmtm
4 Replies

3. Ubuntu

Cron Issue

I have written a custom cron. This cron executes a rake task every 5 minutes. I also log the trace of this execution in a file locally on my server. The whole process seems to execute seamlessly every 5 minutes, but then it seems to log it in /var/log/syslog. I investigated on the syslog and found... (3 Replies)
Discussion started by: manjunath.nm89
3 Replies

4. UNIX for Dummies Questions & Answers

Cron Issue

I have written a custom cron. This cron executes a rake task every 5 minutes. I also log the trace of this execution in a file locally on my server. The whole process seems to execute seamlessly every 5 minutes, but then it seems to log it in /var/log/syslog. I investigated on the syslog and found... (0 Replies)
Discussion started by: manjunath.nm89
0 Replies

5. UNIX for Advanced & Expert Users

Cron Issue

I have written a custom cron. This cron executes a rake task every 5 minutes. I also log the trace of this execution in a file locally on my server. The whole process seems to execute seamlessly every 5 minutes, but then it seems to log it in /var/log/syslog. I investigated on the syslog and found... (0 Replies)
Discussion started by: manjunath.nm89
0 Replies

6. Red Hat

Cron Issue

Hey all! I'm working on setting up a script to run with cron. I have thus far been unable to get it to successfully complete. I'm hoping you gurus can lend me a hand. This is my crontab, the transfer script works fine the backup will not. The backup however does work when I execute it from the... (11 Replies)
Discussion started by: spiffyville
11 Replies

7. Shell Programming and Scripting

A Cron Issue

Hi Guys.,, This thing is driving me crazy.. I have this script which runs perfectly fine. If it is not able to connect to database it will drop a mail which it does when i ran it manually. But when i am running it from crontab, the script is not sending mail to me but to my id(login id)... (0 Replies)
Discussion started by: mac4rfree
0 Replies

8. Red Hat

cron issue

Hello, Having and issue with a job scheduled in cron. The script: #!/bin/bash 2 3 # Example shell script which can be added to roots cron job to check the 4 # Embedded Satellite disk space usage. If any table is over 90% usage, send 5 # a notice to the default email address... (2 Replies)
Discussion started by: mgb
2 Replies

9. Solaris

Cron issue

When I list whats in cron -l its fine but when I try to -e edit it...it returns a number 309 can't you not edit cron this way with solaris 10? I can do it fine in sol 8 and 9. export EDITOR="vi" is set in my profile I am using BASH $ sudo crontab -l Password: #ident "@(#)root ... (5 Replies)
Discussion started by: kingdbag
5 Replies

10. UNIX for Advanced & Expert Users

cron issue

user x has a cron job that looks in a dir and moves teh files from 1 name to another except its not working correctly. . /user/.profile # sorce the users profile for file in `ls`; do mv $file $file.`date +%Y%m%d%H%M%S``microsec` done microsec is a binary with 555 perm. on it in... (5 Replies)
Discussion started by: Optimus_P
5 Replies
Login or Register to Ask a Question