February 11, 201115 yr Hi , My go script is very simple , It suppose to lunch sabnzbd , sickbeard and coachpotato. When I reboot , none of the addons works , but when I run manually by copy paste each of the 5 rows in the if statement then it works and I can use all my addons. If the commands work , I guess the problem is in one of the if statements , but I don't know what. please advice. #!/bin/bash # Start the Management Utility /usr/local/sbin/emhttp & #determine if disk1 drive online , retry upto 7 times for i in 0 1 2 3 4 5 6 7 do if [ ! /mnt/disk1 ] then sleep 15 fi done #If disk1 is online , start SABnzbd , Sickbeard and CouchPotato if [ -d /mnt/disk1]; then cd /mnt/disk1/.custom installpkg /boot/packages/SABnzbdDependencies-2.1-i486-unRAID.tgz python /mnt/disk1/.custom/sabnzbd/SABnzbd.py -d -s 0.0.0.0:8082 python /mnt/disk1/.custom/sickbeard/SickBeard.py --daemon python /mnt/disk1/.custom/CouchPotato/CouchPotato.py -d fi
February 11, 201115 yr If you created the go script in notepad on windows and then copied it over it will have the wrong kind of newlines in it and will behave strangely. I use Edit Pad Lite on windows to edit text files in my \\tower\flash share. Edit Pad Lite has a menu option to set the file as a windows or linux style file. You can use it to open the file, save it using linux style and it would correct that.
February 11, 201115 yr If you created the go script in notepad on windows and then copied it over it will have the wrong kind of newlines in it and will behave strangely. I use Edit Pad Lite on windows to edit text files in my \\tower\flash share. Edit Pad Lite has a menu option to set the file as a windows or linux style file. You can use it to open the file, save it using linux style and it would correct that. The "go" script is processed through "fromdos" so it does not care about carriage returns vs. newlines. the issue is a missing space on the "if" command between the end of the disk name and the closing "]" character. It should be if [ -d /mnt/disk1 ]; then not if [ -d /mnt/disk1]; then
February 11, 201115 yr Author If you created the go script in notepad on windows and then copied it over it will have the wrong kind of newlines in it and will behave strangely. I use Edit Pad Lite on windows to edit text files in my \\tower\flash share. Edit Pad Lite has a menu option to set the file as a windows or linux style file. You can use it to open the file, save it using linux style and it would correct that. The "go" script is processed through "fromdos" so it does not care about carriage returns vs. newlines. the issue is a missing space on the "if" command between the end of the disk name and the closing "]" character. It should be if [ -d /mnt/disk1 ]; then not if [ -d /mnt/disk1]; then I will check it. Is there a way to "debug" the script and see the error it triggers?
February 11, 201115 yr Author I've updated my script to this : #!/bin/bash # Start the Management Utility /usr/local/sbin/emhttp & #determine if disk1 drive online , retry upto 7 times for i in 0 1 2 3 4 5 6 7 do if [ ! /mnt/disk1 ] then sleep 15 fi done #If disk1 is online , start SABnzbd , Sickbeard and CouchPotato if [ -d /mnt/disk1 ]; then cd /mnt/disk1/.custom installpkg /boot/packages/SABnzbdDependencies-2.1-i486-unRAID.tgz python /mnt/disk1/.custom/sabnzbd/SABnzbd.py -d -s 0.0.0.0:8082 python /mnt/disk1/.custom/sickbeard/SickBeard.py --daemon python /mnt/disk1/.custom/CouchPotato/CouchPotato.py -d fi and it still don't work. How can I check whats wrong with the if statement (again , I ran the commands inside manually and all works now)
February 11, 201115 yr Now you are missing the "-d" if [ ! /mnt/disk1 ] should be if [ ! -d /mnt/disk1 ]
February 11, 201115 yr Author Now you are missing the "-d" if [ ! /mnt/disk1 ] should be if [ ! -d /mnt/disk1 ] Adding it now , Thx. This is how I copied it from the instructions.
February 11, 201115 yr If you created the go script in notepad on windows and then copied it over it will have the wrong kind of newlines in it and will behave strangely. I use Edit Pad Lite on windows to edit text files in my \\tower\flash share. Edit Pad Lite has a menu option to set the file as a windows or linux style file. You can use it to open the file, save it using linux style and it would correct that. The "go" script is processed through "fromdos" so it does not care about carriage returns vs. newlines. Thanks for the clarification Joe. I've had this problem with bash scripts and just connected the dots.
Archived
This topic is now archived and is closed to further replies.