Archived

This topic is now archived and is closed to further replies.

ace_69

Run Program Linux

Recommended Posts

Hello,

I am trying to get a bash script to execute as soon as download is finished.

Here's the bash script :


#!/bin/bash
name=$1
cd /home/$name
find . -iname "*.iso" -type f -exec /bin/mv {} /iso/ \;
echo "$name" > /home/test.log // For logging

But 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.

Share this post


Link to post
Share on other sites

I doubt this will help, but perhaps try this...

/usr/bin/bash /path/to/script

Depending 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 logging

Save 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/script
sudo chmod 755 /path/to/script

Share this post


Link to post
Share on other sites
I doubt this will help, but perhaps try this...

/usr/bin/bash /path/to/script

This will help. It may not solve all the problems, but it is part of the solution.

Share this post


Link to post
Share on other sites