Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Go script don't work , But typing each row manually does (script inside)

Featured Replies

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

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.

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

  • 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?

  • 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)

Now you are missing the "-d"

 

    if [ ! /mnt/disk1 ]

should be

    if [ ! -d /mnt/disk1 ]

  • 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.

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.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.