Page 1 of 1

[BASH]Simply post script not working

Posted: July 2nd, 2013, 12:39 am
by LiThiuME3
Hey I got this simple post script that copies .sh files to the final dir and is supose to execute them but it's not properly working :(

The goal is to copy some .sh files that I tweaked from someone code to encode .mkv to mp4 with then hardsub them I did not really know how to do it from scratch with sabnzbd then run the bash scripts that find .mkv and runs all the encoding and everything..

The problem is copy my Bash from my post folder to the nzb final destination folder is not working, I tried to "debug" it by adding echos to see if the function were called, they are called indeed but its like if bash that is copied is not executed.

my code

Code: Select all

#!/bin/bash
echo $1
echo $2
echo $3
folder=$1
copyscripts () {
echo "ok"
echo $folder
cp -fv ~/post/domkvtomp4.sh $folder
cp -fv ~/post/ass-to-srt.sh $folder
echo "done"
}

runscript () {
echo "do bash"
echo $folder/domkvtomp4.sh
chmod 777 $folder/domkvtomp4.sh
chmod 777 $folder/ass-to-srt.sh
bash $folder/domkvtomp4.sh
echo "done bash"
}

copyscripts
sleep 2
runscript


SAB script output

Code: Select all

         /home/lithiume3/downloads/sabnzbd/complete/[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E]
[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E].nzb
[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E]
ok
/home/lithiume3/downloads/sabnzbd/complete/[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E]
`/home/lithiume3/post/domkvtomp4.sh' -> `/home/lithiume3/downloads/sabnzbd/complete/[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E]/domkvtomp4.sh'
`/home/lithiume3/post/ass-to-srt.sh' -> `/home/lithiume3/downloads/sabnzbd/complete/[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E]/ass-to-srt.sh'
done
do bash
/home/lithiume3/downloads/sabnzbd/complete/[A-Destiny]_Toriko_-_111_(848x480_h264_AAC)_[D0A1036E]/domkvtomp4.sh
done bash
if anyone have any idea all suggestions are welcome thanks <3

Re: Simply post script not working

Posted: July 2nd, 2013, 4:30 pm
by shypike
The output suggests that the files are copied.
However, where does your script actually execute the copied scripts?

Re: Simply post script not working

Posted: July 2nd, 2013, 5:01 pm
by LiThiuME3
You're right the files are copied fine at first the chmod was not right 044 I believed thats why the script was not executing, so I included chmod 777 but no luck :s

thanks for your reply, sorry about my bad english :S