Script runs fine, but not in a cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script runs fine, but not in a cron
# 1  
Old 01-23-2010
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!
# 2  
Old 01-23-2010
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
# 3  
Old 01-23-2010
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
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 04:28 PM.. Reason: grammar
# 5  
Old 01-24-2010
Thanks! That was the issue. I appreciate you help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script runs manually, but not from cron

Hi, I "borrowed" a script I found online, to start a SAP router application on a Solaris 11 (SPARC) server. The script runs fine when calling it manually, but when I schedule it to run from cron, it doesn't. I don't see any warning or failure messages anywhere, just nothing happens. ... (11 Replies)
Discussion started by: bredman
11 Replies

2. Shell Programming and Scripting

Script runs in command-line fine but times out in CRON?

Hi, I have a script that seems to run to completion when in the command-line, but when it is run using the cron, it seems to time out. They both start and run fine, but on the CRON it stops prematurely. The script hits an API every few seconds and grabs data. Does anyone have any idea on... (4 Replies)
Discussion started by: phpchick
4 Replies

3. Shell Programming and Scripting

Odd results when my script runs from cron..

Hi folks, So I wrote a script to run "top", "awk" out values fro the "top" and send the results to a data file. I then set it to run in cron every 15 minutes. Now I'm noticing that the script, and it's sub-commands are not always cleanly finishing and, in my investigations, I am also... (11 Replies)
Discussion started by: Marc G
11 Replies

4. AIX

Script runs in shell but not cron

We run some menu driven software that has the ability to batch menu paths and generate reports quickly. Normally you run a batch like: $ BATCH BATCHNAME The batch program then prompts you for the date you want the report run for. I got some help from some folks on IRC to do the following: BATCH... (2 Replies)
Discussion started by: herot
2 Replies

5. Shell Programming and Scripting

Part of the Shell script is not running via crontab, runs fine manually

Hello Team, As a part of my job we have made a script to automate a service to restart frequently. Script having two functions when executing it's should find the existing service and kill it, then start the same service . Verified the script it's working fine when executing... (18 Replies)
Discussion started by: gowthamakanthan
18 Replies

6. Shell Programming and Scripting

Shell script not getting called through cron job but executes fine manually.

Hi, My shell script not getting called through cron job. The same works fine when executed manually. I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins: */5 * * * * /home/myfolder/abc.sh... (17 Replies)
Discussion started by: Dejavu20
17 Replies

7. Shell Programming and Scripting

Script runs fine manually but not in crontab

Hello Guys, I have scratched my head alot on this but couldn't find clue what's wrong. Can you please help me with this? My problem is as following. 1) When I manually execute following script it runs successfully with below output. bash-3.00# more smssend #!/bin/bash echo -e "<Request... (16 Replies)
Discussion started by: umarsatti
16 Replies

8. Shell Programming and Scripting

Shell script runs fine in Solaris, in Linux hangs at wait command

HI, I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging. here is the core of the script CFG_FILE=tab25.cfg sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c do #echo "jobs output" #jobs #echo "jobs... (13 Replies)
Discussion started by: aksaravanan
13 Replies

9. Shell Programming and Scripting

Script Runs fine but not giving any output

Hi, My script is running with no erros but not giving any output can anyonehelp. #!/bin/ksh . /home/application/bin/application.env OUTFILE=Result.txt PROD_PASSWORD=`${GET_PWD} -f ${PWD_FILE_PATH} -s ${PROD_SERVER} -u ${PROD_USER}` echo "1)To get the book last loaded details " read... (7 Replies)
Discussion started by: jagadish_gaddam
7 Replies

10. UNIX for Dummies Questions & Answers

Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server

I have a .sh script which was running fine on all the UNIX Servers (AIX, SunSolaris). The script requires two mandatory parameters and many optional parameters. Now at a different client place who are on a Windows Server, when I try to execute the script through MKS Toolkit, there are couple of... (5 Replies)
Discussion started by: madhunk
5 Replies
Login or Register to Ask a Question