Execution on cron does not work well


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execution on cron does not work well
# 1  
Old 06-02-2009
Execution on cron does not work well

Hallo everyone, this is my first post here and I hope i will learn a lot from you guys.

I have the following command that somehow only works interactively, when I put the the following to the cron, it does not work.

It suppose to move file from one folder to another folder that's all.

Code:
/usr/bin/find /testcron/SessLogs -name "list.log.*" -exec /usr/bin/mv {} /testcron/SessLogs_archive \;


All the file list.log.* exists on this directory.

It works well when i submit manually and my other command works well when i put on cron.

Any advise is appreciated.

Last edited by vidyadhar85; 06-02-2009 at 01:31 AM.. Reason: added code tag
# 2  
Old 06-02-2009
can you post your cron entry??
# 3  
Old 06-02-2009
Does it give you any errors or it doesn't run at all? Have you specified the times correctly?
# 4  
Old 06-02-2009
Quote:
Originally Posted by msetjadi
I have the following command that somehow only works interactively, when I put the the following to the cron, it does not work.

What does "does not work" mean?
What, exactly, does happen, if anything?
Do you get any error messages?
What is your crontab entry?
Quote:
It suppose to move file from one folder to another folder that's all.

When you post code, please wrap it in [code] tags.
Quote:
Code:
/usr/bin/find /testcron/SessLogs -name "list.log.*" -exec /usr/bin/mv {} /testcron/SessLogs_archive \;

All the file list.log.* exists on this directory.

It works well when i submit manually and my other command works well when i put on cron.
# 5  
Old 06-02-2009
Quote:
Originally Posted by devtakh
Does it give you any errors or it doesn't run at all? Have you specified the times correctly?
It runs, but it does not move all the files that was suppose to be found by find command.

cron logs shown succesful run, but none of the files are moved.

No probs on cron timing or entry. When you try to submit that command manually, it works fine, find command found the files and move to destination folder, somehow it doesn't when I put the command on cron.



when I try to run manually, I use the same account too so no access issues.

Any idea?
# 6  
Old 06-02-2009
Does your cron uses the same SHELL that is used when you manually run the command. Meaning, are the PATH to the find and mv commands consistent. You may want to check on that.
It appears to me that either the find or the mv command is not able to execute it. Replace the mv command and only print the files found in the directory. see if that works atleast and you can diagonise the issue. All the best.


-Devaraj Takhellambam
# 7  
Old 06-02-2009
Try putting the command into a script and then run the script from cron.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Good evening, ive got this cron to be run: if i run this manually it doesnt work,it takes me to the prompt again /export/app/CO/opge/scr/Informe_parametros_colombia.ksh >/dev/null 2>&1 here is the code fragment: coopge@coopge: opge PRODUCCION>more... (1 Reply)
Discussion started by: alexcol
1 Replies

3. Shell Programming and Scripting

Execution problems with cron

I am new to creating crontab file , i just wrote below (40 19 * 3 * /root/maths/practisecron.sh), the script just prints "Hi". When ever i save the above file i am getting this . # crontab -e crontab: installing new crontab Can you please check where it went wrong.. (1 Reply)
Discussion started by: vkiyv05
1 Replies

4. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Hi friends, today i created a cron job , registered the crontab file associated but dont know why the cron is not getting executed at the right time.?? content of Crontab file : 21 15 * * * /subrat/myt i wanted to execute the script myt on 15:21 PM of everyday. the script myt... (2 Replies)
Discussion started by: paras.oriental
2 Replies

5. Shell Programming and Scripting

Execution Problems with Cron

Hi, I have written a shell script to transfer files to a SFTP server passing the filername, source and dest directory as parameters and it runs well. :) I want to schedule this script to run periodically using a cron job. root@pingu # cat /etc/crontab SHELL=/bin/bash... (1 Reply)
Discussion started by: chetancrsp18
1 Replies

6. AIX

Execution Problem with Cron

Guys, I am beginer in unix. There is a cobol file with fixed-width. I want to read the total Line, Word and character count. I have tried with wc-l unix command, but it returns '0'. Please advice me the correct command/steps to get the record count. Thanks in advance. (4 Replies)
Discussion started by: vibhar
4 Replies

7. UNIX and Linux Applications

Execution Problems with Cron

Hi all!! I have a nerve-wracking concept (probably for me!!) which is not understood. My crontab entry looks this way. 33 09 22 3 * /home/myexp.sh "Bgp4 ALL" >/dev/null 2>&1 But cron gets started occasionally. Sometimes it does. Sometimes it does not. And sometimes it hangs in the middle (I... (1 Reply)
Discussion started by: dhivyasuresh
1 Replies

8. HP-UX

Manual vs Cron execution in HP-UX

Below is a simple script that will find the path were the perl command reside. ========================= #!/usr/bin/sh nPerl=`which perl 2>>/dev/null|grep -v "no perl"` if ; then echo "No Perl application exist..." else echo "Existing at $nPerl" fi ========================= When I... (2 Replies)
Discussion started by: padi
2 Replies

9. Solaris

cron execution

Hi, Here is the code snippet when executing on the command line it does execute smoothly, but while i place this on cron it doesnt run. Can anybody suggest where the problem in cron is.? #!/usr/bin/ksh home_dir="/export/home/scripts/MonitorScripts" ThresholdLimit=5 touch... (6 Replies)
Discussion started by: rameek20
6 Replies

10. HP-UX

Cron Skips Execution

Hi All, I got a very strange problem, i have created a cron schedule that will run a programme once in every 12 mins, like 04,16,28,40,52 * * * * /myf/startProcessA 1> &- Some time the cron skips the execution such as 04,28 instead of executing at 16 mins. it starts execution at 28, i... (6 Replies)
Discussion started by: nag_sundaram
6 Replies
Login or Register to Ask a Question