![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| crontab + exec command | naushad | Shell Programming and Scripting | 4 | 03-27-2008 12:23 AM |
| Help with exec command and file descriptors?? | rfourn | Shell Programming and Scripting | 1 | 07-18-2007 03:05 PM |
| find command exec error | pavan_test | UNIX for Dummies Questions & Answers | 2 | 06-13-2006 12:58 AM |
| exec command | g_s_r_c | Shell Programming and Scripting | 1 | 09-20-2004 09:20 AM |
| using the -exec command | moxxx68 | UNIX for Dummies Questions & Answers | 0 | 04-13-2004 11:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#22
|
|||
|
|||
|
Oddly enough, I was able to get this to work without any problems
Code:
#!/usr/bin/ksh
find dir1/dir2 -type f -name "FILE.*" -newer dir1/dir2/afterme.txt -exec cp {} dir1/dir2/dir3 \;
|
| Forum Sponsor | ||
|
|
|
#23
|
|||
|
|||
|
Quote:
No I'm not in school. This is a live environment and I'm putting scripts in place to move files around. These exact scripts works on other servers but not this one. |
|
#24
|
|||
|
|||
|
Quote:
It works if I type it manually. But put it in a script and no go. |
|
#25
|
|||
|
|||
|
Oh and I'm running these commands are root, if that makes a difference.
|
|
#26
|
|||
|
|||
|
This is hard for all of us:
what does Code:
echo $PATH Are you running the script in cron? |
|
#27
|
|||
|
|||
|
Quote:
I'm testing it first using the ./scriptname command. Once it works there, then I'll put it in cron. |
|
#28
|
|||
|
|||
|
This sure looks weird.
To sum up what we know so far: OS: RedHat Shell: bash User: root no chrooted environment, no special non-printing characters. First observation: the paths in the script are not absolute paths. This might lead to no directories/files being found when the script is executed in a wrong current path. Change these paths to absolute paths to make the script more robust. Here is another take at problem determination: modify your script by switching on printing of the interpreted lines: Code:
#!/bin/bash
set -xv # <--- makes every line being printed to stdout after parsing
fRootDir="/some/path" # set an absolute starting path
find $fRootDir/dir1/dir2 -type f -name "FILE.*" -newer $fRootDir/dir1/dir2/afterme.txt -exec cp {} $fRootDir/dir1/dir2/dir3 \;
exit 0
Code:
root@server # ./myscript.sh 2> myscript.log I hope this helps. bakunin |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|