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.

lines in go script not executed

Featured Replies

Hi,

 

I have some lines in my go script that are not being executed. This worked fine until my aborted upgrade to 4.4.4 from 4.3.2. The lines are the following:

 

installpkg /mnt/cache/.custom/usr/share/packages/glibc-solibs-2.7-i486-10.tgz

installpkg /mnt/cache/.custom/usr/share/packages/python-2.5.2-i486-1.tgz

installpkg /mnt/cache/.custom/usr/share/packages/zope.interface-3.3.0-noarch-1sl.tgz

installpkg /mnt/cache/.custom/usr/share/packages/twisted-8.0.1-noarch-1sl.tgz

installpkg /mnt/cache/.custom/usr/share/packages/bwm-ng-0.6-i486-2bj.tgz

installpkg /mnt/cache/.custom/usr/share/packages/cxxlibs-6.0.8-i486-4.tgz

installpkg /mnt/cache/.custom/usr/share/packages/unrar-3.7.8-i486-1stc_slack12.1.tgz

 

Other lines such as: echo 192.168.0.4 nas >>/etc/hosts work however.

 

Could this have something to do with the cache drive? It did work before. I have not seen anything in my syslog.

I have some lines in my go script that are not being executed.

No error messages on the boot console?

 

???

 

  • Author

I run my server headless, but there are no messages in the syslog. Copy / pasting the lines in a telnet session work without any problems.

Zip up and attach your entire "go" script.

It might be where the lines are, or something above them exiting the script.

 

It might be timing, is the /mnt/cache disk mounted when you execute these lines?  Or might you need a delay till after it is?

 

Joe L.

You probably need a delay in that script.

if you fire off emhttp in the background and then run these commands there is no guarantee the cache drive is mounted by the time you run the rest of these lines.

 

Just to give you an ideal of what I do...

 

I loop through a test of the MD devices to see if they exist before I continue in my go script.

 

This is my script

 

/boot/custom/etc/rc.d/S02-blockdev

 

If you set the DEV to the highest DEV in your system (mine was MD3 at the time iof writing, it is now MD8)

Then it will pause for up to 10 seconds until the device comes on line.

 

#!/bin/bash

if [ ${DEBUG:=0} -gt 1 ]
   then set -x -v
fi

# Set to highest md device in your system. 

DEV=/dev/md3

while [[ ${LOOP:=10} -gt 1 && ! -b ${DEV} ]]
do
        (( LOOP=LOOP-1 ))
        echo "Waiting for ${DEV} to come online ($LOOP)"
        sleep 1
done

if [ ! -b ${DEV} ]
   then echo "Devices are not online, Array must be offline!"
        exit 129
fi

sleep 1

BUFFER=262144
BUFFER=4096
BUFFER=8192
echo "Devices Online"
for disk in /dev/md*
do  blockdev --setra ${BUFFER} $disk
done

 

 

What you probably need is a loop testing script to wait for the cache to be mounted.

 

Here's a quick -n- crappy script I just wrote, maybe it will help.

Probably needs some debugging

 

I do not have a cache drive so I tested with a

 

[[ ! -d /mnt/cache ]] && mkdir /mnt/cache

mount -o bind /mnt/disk1/cache /mnt/cache

 

#!/bin/bash

# /boot/custom/etc/rc.d/S02-waitcache

if [ ${DEBUG:=0} -gt 1 ]
   then set -x -v
fi

P=${0##*/}              # basename of program
R=${0%%$P}              # dirname of program
P=${P%.*}               # strip off after last . character
O=${P%_*}               # Operand
D=${P#${O}_}            # Data (last param before _ character)

DIR=/mnt/cache

# Define how how many seconds long to wait for mount to become active
MAXLOOP=10
LOOP=0

while  ! `grep -wq ${DIR} < /proc/mounts `
do
        [[ ${LOOP:=0} -eq ${MAXLOOP} ]] && break 
        (( LOOP=LOOP+1 ))
        echo -e "${DIR} waiting for mount.  Attempt: ${LOOP} of ${MAXLOOP}\r\c"
        sleep 1
done

if ! mount | grep -wq ${DIR}
   then echo "${DIR} not mounted after ${MAXLOOP} checks                                  "
        logger -t${P} "${DIR} not mounted after ${MAXLOOP} checks"
        exit 129
   else echo "${DIR} mounted.                                                              "
        logger -t${P} "${DIR} mounted after ${LOOP} checks"
fi


# Put commands here that you want to execute ONLY 
# when the directory in question is mounted



exit 0

  • Author

It was the cache drive that had not come on line when the script ran. It used to work for me since I had this code that I removed:

 

# Increase block size for performance improvement
#sleep 30
#for i in /dev/md*
#do
#    blockdev --setra 2048 $i
#done

 

I added sleep 30 back to the go script and now it works as it worked earlier.

 

Thanks for the help.

 

Roland

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.