Jump to content

Run Program Linux


ace_69

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.

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

  • 3 months later...

Archived

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

×
×
  • Create New...