I have been using SABnzbd for a month now and I am very satisfied with it. I have installed it on my Linux server. All downloaded files end up in the "complete" dropbox for further redirection. This is a little drawback if your downloaded file is an ISO and you want to convert it first. A web-based program mounting ISO-files from the "complete"-dropbox would be a nice feature, certainly on a Linux server without a graphical (drag and drop) interface like mine.
So, I tried to write a script doing just that. Being rather new on writing scripts it took me a few hours to understand that this would be tricky. A Linux script will open a new process for each command in the command shell. So, for instance a cd command does not seem to work, as it was opened in a new process environment which is lost when control reverts to the parent process.
After a lot of thinking I came up with following scripts which may be useful. If anybody can improve the scripts I would be interested to learn how.
I assume there is a PuTTY terminal logged in on the Linux server as root. In the root directory there are 2 scripts, mountDVD and umountDVD. Only the locations of the parent directory for the "complete" dropbox (which will be called /parent) and the mount directory need to be adapted. This involves 2 parameters clearly identified.
mountDVD calls another script, called mountFile located in subdirectory /parent/aux. No need to modify this script.
This script will go down 1 or 2 levels from /parent/complete and then list the ISO and iso files that are found in the lowest level present. The last file of the list will be mounted as a loop device /dev/loop0.
I assume that non-iso/ISO files have alreay been redirected so that in /parent/complete there are only ISO/iso files left. The script will only mount the last ISO/iso file, so after mounting you need to move the mounted file, umountDVD and run the script again for the next ISO/iso file, if any.
The scripts have worked well for me. Here they are:
1. mountDVD on /root (Modify params PRNTDIR and MNTDIR)
- # Script for mounting ISO-files
# Roel vdH 26-02-2010
#
# Specify parent directory of directory "complete"
# Specify directory where iso/ISO-file will be mounted
#
PRNTDIR="/home/roel/comms/downloads"
MNTDIR="/home/roel/comms/mountDVD"
#
rm -f mnt1
cat $PRNTDIR/aux/mountFile > mnt1
source mnt1
- # Script for unmounting ISO-files
# Roel vdH 26-02-2010
#
# Change mount directory
#
rm -f mnt1
echo 'umount /home/roel/comms/mountDVD ' > mnt1
source mnt1
3. mountFile on /parent/aux
- # Script for mounting ISO-files
# Roel vdH 26-02-2010
#
# Called from and returns to root directory ~
# Will go down 1 or 2 levels from parent directory of directory "complete"
# Looking for files *.ISO and *.iso
# Will select last subdirectory in list
# Will select last line with either ISO or iso in list
#
rm -f $PRNTDIR/aux/aux*
#
echo
echo -- mountDVD - Step 1: listing files and directories level -1
echo
ls $PRNTDIR/complete > $PRNTDIR/aux/aux1
cat $PRNTDIR/aux/aux1
echo
echo -n 'cd "$PRNTDIR/complete/' > $PRNTDIR/aux/aux2
cat $PRNTDIR/aux/aux1 | tail -1 >> $PRNTDIR/aux/aux2
cat $PRNTDIR/aux/aux2 | tr -d "\n" > $PRNTDIR/aux/aux3
echo '"' >> $PRNTDIR/aux/aux3
# chmod 700 $PRNTDIR/aux/aux3
source $PRNTDIR/aux/aux3
echo -- mountDVD - Step 2: listing files and directories level -2
echo
ls > $PRNTDIR/aux/aux4
cat $PRNTDIR/aux/aux4
echo
echo -n 'cd "' > $PRNTDIR/aux/aux5
cat $PRNTDIR/aux/aux4 | tail -1 >> $PRNTDIR/aux/aux5
cat $PRNTDIR/aux/aux5 | tr -d "\n" > $PRNTDIR/aux/aux6
echo '"' >> $PRNTDIR/aux/aux6
# chmod 700 $PRNTDIR/aux/aux6
source $PRNTDIR/aux/aux6
echo -n '-- mountDVD - Step 3: iso and ISO-files in directory ' ; pwd
echo
ls | grep ISO > $PRNTDIR/aux/aux7
ls | grep iso >> $PRNTDIR/aux/aux7
cat $PRNTDIR/aux/aux7
echo
echo -n '-- mountDVD - Step 4: Mount file ' ; cat $PRNTDIR/aux/aux7 | tail -1
echo
echo -n 'mount -t iso9660 -o ro,loop=/dev/loop0 ' > $PRNTDIR/aux/aux8
cat $PRNTDIR/aux/aux7 | tail -1 >> $PRNTDIR/aux/aux8
cat $PRNTDIR/aux/aux8 | tr -d "\n" > $PRNTDIR/aux/aux9
echo -n ' ' >> $PRNTDIR/aux/aux9
echo $MNTDIR >> $PRNTDIR/aux/aux9
source $PRNTDIR/aux/aux9
echo -n '-- mountDVD - In absence of error messages : Successfully mounted on '
echo $MNTDIR
echo
cd /root
The script is only valid for DVD iso files using the iso9660 filesystem which is the standard filesystem for DVD. Very easy to change for other iso variants.
Good luck!