find cmd works different on cron job ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find cmd works different on cron job ?
# 1  
Old 08-09-2010
find cmd works different on cron job ?

Code:
/usr/bin/find  $SEARCH_DIR  -daystart \( \( -name 'KI*' -a -name '*.csv' \) -o  -name '*_xyz_*' \)  -mtime $DAYS_AGO -printf %f -printf "\n" | sort -r > $FILES

The above command gives different results when run on a cron job. When run manually the result is accurate.
# 2  
Old 08-09-2010
Define "different results" a bit more clearly. Are $SEARCH_DIR, $DAYS_AGO, and $FILES defined? Is the command called in cron directly, or inside a script called by cron?
# 3  
Old 08-09-2010
I meant different for the "Number of files find returns".

Search directory is standard everytime. Days ago is 1 (which is yesterday).

The command is called in a script which is run by cron, but the number of files are written to a file called files.txt.

If the files are more, say 300+ then cron fails to write all the files to files.txt and If I run the script manually the files are all being written. And this behaviour is not consistent. I cant say each time the cron fails, but mostly if there are more files I see a difference in the number of files returned.
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. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

3. AIX

Cron job not working but works on other nodes.

Hi All, I have a many cron jobs scheduled in my AIX server. Only one cron not getting executed in the same server but that job is good on all other servers. Here is my cron , which will keep last 30 files and remove others., 00 00 * * * /usr/bin/find /tmp/reports/nmon -name *.nmon -mtime... (9 Replies)
Discussion started by: Thala
9 Replies

4. Windows & DOS: Issues & Discussions

Command works on CMD line but not in batch?

Hi All, This command works when I type it on but when I run the batch file it doesn't..any ideas why? attrib.exe * | find /c /v "" >filecount.txt (1 Reply)
Discussion started by: Grueben
1 Replies

5. UNIX for Advanced & Expert Users

SSH key works from CMD line not script

OK , .. This is an odd one. I have a new server and I need to have a tunnel open to it. I have this exact process running on a few others but this new one I just got is not allowing the script to connect. I set up my users account and ssh keys from the server that will host the tunneling i... (6 Replies)
Discussion started by: jeffsandman0035
6 Replies

6. Shell Programming and Scripting

sed command works from cmd line to standard output but will not write to file

Hi all .... vexing problem here ... I am using sed to replace some special characters in a .txt file: sed -e 's/_<ED>_/_355_/g;s/_<F3>_/_363_/g;s/_<E1>_/_341_/g' filename.txt This command replaces <ED> with í , <F3> with ó and <E1> with á. When I run the command to standard output, it works... (1 Reply)
Discussion started by: crumplecrap
1 Replies

7. Shell Programming and Scripting

"ld.so.1" error using a cron job | works fine otherwise

Hi, A cron job CJ invokes a shell script SC. SC internally invokes multiple perl scripts. One of the perl scripts deals with Accurev (i am using Accurev CLI). The first accurev command encountered is accurev merge -i <<file_name>> (file name has absolute path) When I run the perl script or... (1 Reply)
Discussion started by: singh
1 Replies

8. Shell Programming and Scripting

Cron job fails, but works fine from command line

I have a very basic script that essentially sends a log file, via FTP, to a backup server. My cron entry to run this every night is: 55 23 * * * /usr/bin/archive_logs The script runs perfectly when executed manually, and actually worked via cron for about three weeks. However, it mysteriously... (3 Replies)
Discussion started by: cdunavent
3 Replies

9. UNIX for Dummies Questions & Answers

script works on command line, not in cron job

Hey there, I'm a total newbie unix guy here and just picking this stuff up. Have a very small script I put together that works fine from the command line but not once I put it in a cron job. Searched and found this thread and am wondering it it has something to do with setting variables, though the... (7 Replies)
Discussion started by: JackTheTripper
7 Replies

10. Shell Programming and Scripting

works from cmd-line but not in script

hi I'm trying to query a directory, check it's the right directory, return the results into a text file, put text file into an array and navigate the subdirectories and delete contents. find `pwd` -type d | grep TESTINGDIR > dirList.txt The txt file is created from the cmd-line but not in... (4 Replies)
Discussion started by: OFFSIHR
4 Replies
Login or Register to Ask a Question