ace_69 Posted July 2, 2013 Report Share Posted July 2, 2013 Hello,I am trying to get a bash script to execute as soon as download is finished.Here's the bash script :#!/bin/bashname=$1cd /home/$namefind . -iname "*.iso" -type f -exec /bin/mv {} /iso/ \;echo "$name" > /home/test.log // For loggingBut the problem is the script is not getting executed :/, running manually the script runs fine.Here's what i am using to call from utorrent/home/raw_process.sh "%D" "%D"Any help would be much appreciated. Link to comment Share on other sites More sharing options...
HNx Posted July 31, 2013 Report Share Posted July 31, 2013 I doubt this will help, but perhaps try this.../usr/bin/bash /path/to/scriptDepending on your distro, bash might be located elsewhere, best to avoid symlinks.Get the location with and if symlinked check where.ls -l $(which bash)I assume you've made the script executable, but did you also make sure that whatever user that utserver runs under also has permissions to read and execute the script?Try dropping the script into the utserver's working directory.Also for your script I noticed a few possible hang-ups.Here it is with a few modification I've made.#!/bin/bash# Variable name changed just for good practice# Find command changed a bit to make sure it doesn't run into trouble.# Changed the comment after the echo command that may have caused trouble.# Changed to echo command to append rather than overwrite the logfile.NAME_1="$1"cd "/home/$NAME_1"find . -regex ".*\.\(iso\|ISO\)$" -type f -exec /bin/mv "{}" /iso/ \;echo "$NAME_1" >> /home/test.log # For loggingSave script and do fix permissions. (Assuming "utserver" is both the user and group that utserver will be urnning under, if not, fix accordingly.)sudo chown utserver:utserver /path/to/scriptsudo chmod 755 /path/to/script Link to comment Share on other sites More sharing options...
Kitsoran Posted August 2, 2013 Report Share Posted August 2, 2013 If shell binary location is a concern wouldn't #!/usr/bin/env bash be a better choice? http://en.wikipedia.org/wiki/Shebang_(Unix)#Portability Link to comment Share on other sites More sharing options...
mcdonald Posted November 7, 2013 Report Share Posted November 7, 2013 I doubt this will help, but perhaps try this.../usr/bin/bash /path/to/scriptThis will help. It may not solve all the problems, but it is part of the solution. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.