find command in script getting access denied in my crontab but works when I run it manually
so i have two scripts for generating shortcuts to my movies to put in one centralized folder. i have the crontab service installed and it is running under my user name. both scripts work from the command line when run manually as me but script #2 does not. script #1 - works from the command line and in crontab: rm c:/Movies/* ln -s f:/Movies\ 2/* c:/Movies ln -s g:/Movies\ 3/* c:/Movies script #2 - works from the command line but not in crontab (this scripts creates links for movies modified less than 30 days old): rm c:/NEW\ Movies/* find f:/Movies\ 2/* -maxdepth 0 -mtime -30 -exec ln -s {} c:/NEW\ Movies \; find g:/Movies\ 3/* -maxdepth 0 -mtime -30 -exec ln -s {} c:/NEW\ Movies \; Here is the output from cron.log in my home directory Access denied - F:/MOVIES 2/15 MINUTES Access denied - F:/MOVIES 2/28 DAYS LATER Access denied - F:/MOVIES 2/FINAL DESTINATION 2 Access denied - F:/MOVIES 2/LED ZEPPELIN - THE SONG REMAINS THE SAME Access denied - F:/MOVIES 2/MUSIC AND LYRICS Access denied - F:/MOVIES 2/NAPOLEON DYNAMITE Access denied - F:/MOVIES 2/SCARY MOVIE Access denied - F:/MOVIES 2/SPIDERMAN 2 Access denied - F:/MOVIES 2/SUICIDE KINGS Access denied - F:/MOVIES 2/THE BUTTERFLY EFFECT Access denied - F:/MOVIES 2/THE GOOD SHEPHERD Access denied - F:/MOVIES 2/UNCLE BUCK Access denied - F:/MOVIES 2/UNDERWORLD Access denied - F:/MOVIES 2/WAYNE'S WORLD Access denied - F:/MOVIES 2/WAYNE'S WORLD 2 File not found - -MAXDEPTH File not found - 0 File not found - -MTIME File not found - -30 File not found - -EXEC File not found - LN File not found - -S File not found - {} Access denied - C:/NEW MOVIES File not found - ; Access denied - G:/MOVIES 3/ALIEN Access denied - G:/MOVIES 3/AMERICAN PSYCHO Access denied - G:/MOVIES 3/AUSTIN POWERS 2 - THE SPY WHO SHAGGED ME Access denied - G:/MOVIES 3/BILL AND TED'S EXCELLENT ADVENTURE Access denied - G:/MOVIES 3/COYOTE UGLY Access denied - G:/MOVIES 3/DESPERADO Access denied - G:/MOVIES 3/GHOSTBUSTERS 2 Access denied - G:/MOVIES 3/GOLDENEYE Access denied - G:/MOVIES 3/HELLRAISER I Access denied - G:/MOVIES 3/IN THE MOUTH OF MADNESS Access denied - G:/MOVIES 3/JURASSIC PARK 3 Access denied - G:/MOVIES 3/KINDERGARTEN COP Access denied - G:/MOVIES 3/LIFE OF BRIAN Access denied - G:/MOVIES 3/O Access denied - G:/MOVIES 3/REMEMBER THE TITANS Access denied - G:/MOVIES 3/SAVING PRIVATE RYAN Access denied - G:/MOVIES 3/SOUTH PARK - BIGGER, LONGER, AND UNCUT Access denied - G:/MOVIES 3/SURVIVING CHRISTMAS Access denied - G:/MOVIES 3/TERMINATOR Access denied - G:/MOVIES 3/TERMINATOR 2 Access denied - G:/MOVIES 3/TERMINATOR 3 - RISE OF THE MACHINES Access denied - G:/MOVIES 3/THE CROW Access denied - G:/MOVIES 3/THE TRUMAN SHOW Access denied - G:/MOVIES 3/TRUE LIES Access denied - G:/MOVIES 3/WISHMASTER 3 - BEYOND THE GATES OF HELL Access denied - G:/MOVIES 3/WITHOUT A PADDLE Access denied - G:/MOVIES 3/X-MEN File not found - -MAXDEPTH File not found - 0 File not found - -MTIME File not found - -30 File not found - -EXEC File not found - LN File not found - -S File not found - {} Access denied - C:/NEW MOVIES File not found - ; FIND: Parameter format not correct FIND: Parameter format not correct Anyone have any idea why the find isn't working properly when in the crontab? I dont actually think it's a permission denied issue but something with the parsing possible (since I made sure i have full access to all the files and the script works from the command line). maybe it's something with the environment variables. thanks in advance for any ideas. -- View this message in context: http://www.nabble.com/find-command-in-script-getting-access-denied-in-my-crontab-but-works-when-I-run-it-manually-tf4471242.html#a12748796 Sent from the Cygwin Users mailing list archive at Nabble.com. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: find command in script getting access denied in my crontab but works when I run it manually
On 09/17/2007, kuliksco wrote: Anyone have any idea why the find isn't working properly when in the crontab? I dont actually think it's a permission denied issue but something with the parsing possible (since I made sure i have full access to all the files and the script works from the command line). maybe it's something with the environment variables. thanks in advance for any ideas. The problem is that you're assuming that the environment you have when you run interactively is the same environment you have when you run the script through 'cron'. That is not true. If you require a particular environment for a script to run, you need to include those settings in your crontab. This is standard operating procedure for 'cron'. It is not Cygwin specific. See cron/crontab documentation for more information. Actually, both your scripts suffer from the problem I mentioned above. You just have better luck with the first because: 1. You apparently do have Cygwin's bin directory in your system-wide Windows path. 2. There is no like-named Windows utility. (2) does not hold true for 'find'. You should either define the same path as you use for your user environment in your crontab or fully qualify the path to the utilities you want (i.e. '/bin/find' and '/bin/ln'). I'd also highly recommend using POSIX-style paths (i.e. '/cygdrive/f') over DOS-like paths (i.e. 'f:/'). You'll have less troubles in general. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _ A: Yes. Q: Are you sure? A: Because it reverses the logical flow of conversation. Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: find command in script getting access denied in my crontab but works when I run it manually
thanks i got it working! yea i knew they had separate environments i forgot microsoft had a find command though :\ thanks alot though!! Larry Hall (Cygwin) wrote: On 09/17/2007, kuliksco wrote: Anyone have any idea why the find isn't working properly when in the crontab? I dont actually think it's a permission denied issue but something with the parsing possible (since I made sure i have full access to all the files and the script works from the command line). maybe it's something with the environment variables. thanks in advance for any ideas. The problem is that you're assuming that the environment you have when you run interactively is the same environment you have when you run the script through 'cron'. That is not true. If you require a particular environment for a script to run, you need to include those settings in your crontab. This is standard operating procedure for 'cron'. It is not Cygwin specific. See cron/crontab documentation for more information. Actually, both your scripts suffer from the problem I mentioned above. You just have better luck with the first because: 1. You apparently do have Cygwin's bin directory in your system-wide Windows path. 2. There is no like-named Windows utility. (2) does not hold true for 'find'. You should either define the same path as you use for your user environment in your crontab or fully qualify the path to the utilities you want (i.e. '/bin/find' and '/bin/ln'). I'd also highly recommend using POSIX-style paths (i.e. '/cygdrive/f') over DOS-like paths (i.e. 'f:/'). You'll have less troubles in general. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _ A: Yes. Q: Are you sure? A: Because it reverses the logical flow of conversation. Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- View this message in context: http://www.nabble.com/find-command-in-script-getting-access-denied-in-my-crontab-but-works-when-I-run-it-manually-tf4471242.html#a12749094 Sent from the Cygwin Users mailing list archive at Nabble.com. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: find command in script getting access denied in my crontab but works when I run it manually
kuliksco wrote: thanks i got it working! yea i knew they had separate environments i forgot microsoft had a find command though :\ thanks alot though!! You're welcome. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalton Rd. (508) 893-9889 - FAX Holliston, MA 01746 _ A: Yes. Q: Are you sure? A: Because it reverses the logical flow of conversation. Q: Why is top posting annoying in email? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/