Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Script runs fine, but not in a cron

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-23-2010
sammyk sammyk is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 24 January 2010, 3:52 PM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Script runs fine, but not in a cron

Okay, I have the following script that runs fine from a command line as well as an executable .sh file. It just moves any file/folder with movie* in the name to a folder called _Movies. The issue I'm running into is when it's call from a cron.

Code:
find /mnt/HD_a2/BT/complete -iname "movie.*" -exec mv {} /mnt/HD_a2/BT/complete/_Movies \;

Crontab looks like the following, with my scripts being called move_downloads.sh

Code:
32 2 * * * /usr/sbin/rtc -s
30 2 2 * * /usr/sbin/rtc -c
59 1 * * * /usr/sbin/daylight &
*/10 * * * * /usr/sbin/offl_chk two &
*/60 * * * * /usr/sbin/getdhcp&
* * * * * /ffp/sbin/move_downloads.sh >> /mnt/HD_a2/move_downloads.log 2>&1

I realize it's running every minute, but it's set that way while I debug it. I get the following in the log file, and the movie does not move when the cron job is ran.

Code:
BusyBox v1.00-pre1 (2008.09.02-11:43+0000) multi-call binary

Usage: find [PATH...] [EXPRESSION]

Any ideas? I'm going crazy trying to figure out what could be wrong. Thanks!
Sponsored Links
    #2  
Old 01-23-2010
EAGL€ EAGL€ is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 8 December 2017, 5:27 AM EST
Location: izmir
Posts: 331
Thanks: 33
Thanked 13 Times in 13 Posts
hello,

when you remove the
Code:
2>&1

part it will work. I think the answer is hidden in this link that i saw a few days ago here :

https://www.unix.com/shell-programmin...login-csh.html
Sponsored Links
    #3  
Old 01-23-2010
sammyk sammyk is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 24 January 2010, 3:52 PM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
I just tried that, but it still doesn't seem to work. I get the same results, but now with an empty log file.
    #4  
Old 01-24-2010
Loic Domaigne Loic Domaigne is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 26 December 2011, 4:26 PM EST
Location: Munich (Germany)
Posts: 244
Thanks: 0
Thanked 25 Times in 25 Posts
Quote:
Any ideas? I'm going crazy trying to figure out what could be wrong. Thanks!
Yeah. I think the problem is that you are using the find that comes with busybox (located in /bin), and not the find that comes with ffp (located at /ffp/bin/find). Try simply to export the path to /ffp in your script and your cron should work as expected:
Code:
 export PATH=/ffp/sbin:/ffp/bin:$PATH

By the way do you know this forum: DSM-G600, DNS-323 and TS-I300 Hack Forum? This would be a good place to raise such issue.

Cheers,
Loïc.

Last edited by Loic Domaigne; 01-24-2010 at 03:28 PM.. Reason: grammar
Sponsored Links
    #5  
Old 01-24-2010
sammyk sammyk is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 24 January 2010, 3:52 PM EST
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks! That was the issue. I appreciate you help.
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cron job fails, but works fine from command line cdunavent Shell Programming and Scripting 3 09-24-2008 12:58 PM
Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server madhunk UNIX for Dummies Questions & Answers 5 01-31-2008 12:30 PM
SFTP errorcode 1 when run on cron but runs manually Heidi.Ebbs Solaris 2 08-08-2007 12:16 PM
Old cron entry still runs, but shouldnt xadamz23 UNIX for Advanced & Expert Users 3 10-11-2005 05:11 PM
What user runs cron? michieka UNIX for Dummies Questions & Answers 10 06-02-2002 10:32 PM



All times are GMT -4. The time now is 11:46 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?