I have an old implementation of FreeNAS running FreeBSD 9.0 RC2. I need to run a very simple script:
Unfortunately, for some inscrutable reason, when the shell executes:
it throws an error as file not found? (it is not finding cdfn0) and it never mounts the CD rom. However, if I execute every single frigging line manually (one by one) it works OK! WTF?
Any idea what's wrong?
The value of $1 that I am using is not a switch but arbitrary text to create a folder name. Since this system is an old FreeNAS, it lacks the read command and so this is the only way I found to pass the name of a variable to the script. I have to migrate close to 400 CD's and DVD's into a FreeNAS system.
When I run the script with the -x parameter I get:
As far as I can tell, the line that is failing is the mount line.
As to
Oh, FYI, I can strip the script down to the mount line only (no parameters to pass) and it still fails. If I take the mount line verbatim and execute it manually, it works without any problems. FYI #2: I am logged in as root, so there are no rights issues either.
Any ideas?
Code:
#!/bin/sh
echo "$1"
echo /tank1/validation/"$1"
mount -t cd9660 /dev/cd0 /mnt/cdfn0
cp -R -n /mnt/cdfn0/* /tank1/validation/"$1"
umount /mnt/cdfn0
chmod -R 777 /tank1/validation/"$1"
camcontrol eject cd0
Unfortunately, for some inscrutable reason, when the shell executes:
Code:
mount -t cd9660 /dev/cd0 /mnt/cdfn0
it throws an error as file not found? (it is not finding cdfn0) and it never mounts the CD rom. However, if I execute every single frigging line manually (one by one) it works OK! WTF?
Any idea what's wrong?
The value of $1 that I am using is not a switch but arbitrary text to create a folder name. Since this system is an old FreeNAS, it lacks the read command and so this is the only way I found to pass the name of a variable to the script. I have to migrate close to 400 CD's and DVD's into a FreeNAS system.
When I run the script with the -x parameter I get:
Code:
freenas:/tank1# sh -x cd0iso.sh A005
+ echo A005
A005
+ echo /tank1/validation/A005
/tank1/validation/A005
+ mount -t cd9660 /dev/cd0 /mnt/cdfn0
: No such file or directory
+ cp -R -n '/mnt/cdfn0/*' /tank1/validation/A005
cp: /mnt/cdfn0/*: No such file or directory
+ umount /mnt/cdfn0
: statfs: No such file or directory
: unknown file system
+ chmod -R 777 /tank1/validation/A005
: No such file or directory05
+ camcontrol eject cd0
camcontrol: cam_get_device: unable to find device unit number
+
: not found
+
: not found
+
: not found
As far as I can tell, the line that is failing is the mount line.
As to
chmod 777
, yes, I know, but the system is on a closed LAN with zero chances of being hacked. It simply makes my life easier.Oh, FYI, I can strip the script down to the mount line only (no parameters to pass) and it still fails. If I take the mount line verbatim and execute it manually, it works without any problems. FYI #2: I am logged in as root, so there are no rights issues either.
Any ideas?