go script not completing


Recommended Posts

Hi All,

 

I have been using unRaid 4.3 pro for a while now and only just upgraded to 4.4 pro + BubbaRaid Version 0.0.9-Alpha. The problem is (and has always been there, i've just never followed it up), that my 'go' script does not seem to complete all the commands I have set in it.

 

The first half seems to work without issue but it doesn't complete.

 

Script:

#!/bin/bash
# Start the Management Utility
# Modified by BubbaRaid
#

# set unraidport to the port for emhttp to use for a standard unRAID boot
# set bubbaraidport to the port for emhttp to use for a BubbaRaid boot

unraidport=80
bubbaraidport=88

# Test the uname to see if BubbaRaid was booted
uname -r | egrep "(Bubba)|(bubba)" >/dev/null 2>&1
if [ ! $? = 0 ]
  then
    port=$unraidport
  else
    port=$bubbaraidport
fi

echo "Starting unRAID Management Utility on port" $port
/usr/local/sbin/emhttp -p $port &

# Performance tweak - speed up samba requests
echo nameserver 192.168.1.254 >/etc/resolv.conf
echo 192.168.1.200 TANK >>/etc/hosts
/boot/cache

# Load unmenu
cd /boot
nohup sh -c "while true; do awk  -W re-interval -f /boot/unmenu.awk; done" >/dev/null 2>&1 &
cd /boot/packages && find . -name '*.auto_install' -type f -print | sort | xargs -n1 sh -c

# install SNMP
installpkg /boot/packages/net-snmp-5.4-i486-6.tgz
rm -rf /etc/snmp/snmpd.conf
ln -s /boot/packages/snmpd.conf /etc/snmp/snmpd.conf

# install bandwidth monitor for unmenu
installpkg /boot/packages/bwm-ng-0.6-i486-2bj.tgz

# Add extra cache size to all drives
sleep 240
for i in /dev/md*
do
  blockdev --setra 2048
fi

# mount music files for SlimServer
mkdir /Music
mount.cifs //TANK/MEDIA/mp3 /Music/ -o user=root -o pass=<REMOVED>

# w/rtorrent config copy
cp /boot/bubba/rtorrent/.rtorrent.rc /root/

# Beep PC speaker 5 times so I know this has completed
beep -l 100 -r 5

 

From what I can work out, this gets up to the "# Load unmenu" part and then doesn't continue..

 

Any idea's?

 

 

Cheers

Link to comment

Hi All,

 

I have been using unRaid 4.3 pro for a while now and only just upgraded to 4.4 pro + BubbaRaid Version 0.0.9-Alpha. The problem is (and has always been there, i've just never followed it up), that my 'go' script does not seem to complete all the commands I have set in it.

 

The first half seems to work without issue but it doesn't complete.

 

Script:

#!/bin/bash
# Start the Management Utility
# Modified by BubbaRaid
#

# set unraidport to the port for emhttp to use for a standard unRAID boot
# set bubbaraidport to the port for emhttp to use for a BubbaRaid boot

unraidport=80
bubbaraidport=88

# Test the uname to see if BubbaRaid was booted
uname -r | egrep "(Bubba)|(bubba)" >/dev/null 2>&1
if [ ! $? = 0 ]
  then
    port=$unraidport
  else
    port=$bubbaraidport
fi

echo "Starting unRAID Management Utility on port" $port
/usr/local/sbin/emhttp -p $port &

# Performance tweak - speed up samba requests
echo nameserver 192.168.1.254 >/etc/resolv.conf
echo 192.168.1.200 TANK >>/etc/hosts
/boot/cache

# Load unmenu
cd /boot
nohup sh -c "while true; do awk  -W re-interval -f /boot/unmenu.awk; done" >/dev/null 2>&1 &
cd /boot/packages && find . -name '*.auto_install' -type f -print | sort | xargs -n1 sh -c

# install SNMP
installpkg /boot/packages/net-snmp-5.4-i486-6.tgz
rm -rf /etc/snmp/snmpd.conf
ln -s /boot/packages/snmpd.conf /etc/snmp/snmpd.conf

# install bandwidth monitor for unmenu
installpkg /boot/packages/bwm-ng-0.6-i486-2bj.tgz

# Add extra cache size to all drives
sleep 240
for i in /dev/md*
do
  blockdev --setra 2048
fi

# mount music files for SlimServer
mkdir /Music
mount.cifs //TANK/MEDIA/mp3 /Music/ -o user=root -o pass=<REMOVED>

# w/rtorrent config copy
cp /boot/bubba/rtorrent/.rtorrent.rc /root/

# Beep PC speaker 5 times so I know this has completed
beep -l 100 -r 5

 

From what I can work out, this gets up to the "# Load unmenu" part and then doesn't continue..

 

Any idea's?

 

 

Cheers

I'd comment out lines, either one by one, or half at a time, until it did get to the end of the script.  (you will need to do all the lines in the "setra" loop at one time, otherwise you will introduce a syntax error.)

 

Then, go from there.

 

You could also try something like this:

"Stop" the array                <-------------- this should keep your array sane as you kill and re-start emhttp when you re-run the go script

log in via telnet

killall emhttp

sh -xv /boot/config/go 2>&1 | tee /tmp/go.out

 

Lots of lines will scroll by as the script runs.  You will see lines before they are evaluated, and variables as they are assigned values.  The output will also be saved in /tmp/go.out

When the process "freezes" type "Control-C" to exit it.

 

The issue could be any of the "auto_install" scripts in the /boot/packages directory.  But regardless of what it is, when you see the process stop, you will know what it was trying to do.

You might want to start a second telnet session (open up two windows) and then when it stops type

ps -ef

and see what it is trying to execute.

 

 

Link to comment


# Add extra cache size to all drives
sleep 240
for i in /dev/md*
do
'boot/config/go: line 45: syntax error near unexpected token `do
'boot/config/go: line 45: `do


 

:-)

 

 

I have changed this now, and there is a different message. (nb: I have no idea what /boot/cache was in there for so I removed it)

 

New go script:

#!/bin/bash
# Start the Management Utility
# Modified by BubbaRaid
#

# set unraidport to the port for emhttp to use for a standard unRAID boot
# set bubbaraidport to the port for emhttp to use for a BubbaRaid boot

unraidport=80
bubbaraidport=88

# Test the uname to see if BubbaRaid was booted
uname -r | egrep "(Bubba)|(bubba)" >/dev/null 2>&1
if [ ! $? = 0 ]
  then
    port=$unraidport
  else
    port=$bubbaraidport
fi

echo "Starting unRAID Management Utility on port" $port
/usr/local/sbin/emhttp -p $port &

# Performance tweak - speed up samba requests
echo nameserver 192.168.1.254 >/etc/resolv.conf
echo 192.168.1.200 TANK >>/etc/hosts

# Load unmenu
cd /boot
nohup sh -c "while true; do awk  -W re-interval -f /boot/unmenu.awk; done" >/dev/null 2>&1 &
cd /boot/packages && find . -name '*.auto_install' -type f -print | sort | xargs -n1 sh -c

# install SNMP
installpkg /boot/packages/net-snmp-5.4-i486-6.tgz
rm -rf /etc/snmp/snmpd.conf
ln -s /boot/packages/snmpd.conf /etc/snmp/snmpd.conf

# install bandwidth monitor for unmenu
installpkg /boot/packages/bwm-ng-0.6-i486-2bj.tgz

# Add extra cache size to all drives
blockdev --setra 2048 /dev/md*

# mount music files for SlimServer
mkdir /Music
mount.cifs //TANK/MEDIA/mp3 /Music/ -o user=root -o pass=<REMOVED>

# w/rtorrent config copy
cp /boot/bubba/rtorrent/.rtorrent.rc /root/

# Beep PC speaker 5 times
beep -l 100 -r 5

 

The error message is now:

/boot/config/go: line 53: syntax error: unexpected end of file

Line 52 + 53  are the last 2 lines of the script (beep pc speaker). I've checked and there are no 'foreign' characters that would cause this.

 

EDIT:

 

God I'm a waldo... whilst I was looking for the foreign characters, I realised I was saving the 'go' file in DOS format (nano / vi told me this and I ignored it). I must have edited it from Windows at some stage. I've saved it back to its normal format and everything now works.

 

 

Thanks guys!!

 

Link to comment

Your blockdev command appears to be wrong, in each case I've seen in your scripts included above.  I believe it should be a loop like this:

sleep 30
for i in /dev/md*
do
  blockdev --setra 2048 $i
done

 

Make sure that a done finishes the do loop, not an fi.  That unmatched fi may have been causing some of the difficulties earlier.  And the blockdev needs an object after the 2048.

 

cd /boot/packages && find . -name '*.auto_install' -type f -print | sort | xargs -n1 sh -c

 

You probably do, but make sure you have a /boot/packages folder already created, a /packages folder in the root of your flash drive.  That may have been stopping that line from executing.

Link to comment
  • 2 years later...

Joe L's advise was great to fix my go script issues as well - as always.

 

One item remains which is the part below:

 

#wait until all the configured disks are mounted
num_configured=`grep "disk[0-9]*=" /boot/config/disk.cfg | wc -l`
while sleep 5
do
md_disk_mounted=`mount | grep "/dev/md[0-9]*" | wc -l`
[ "$num_configured" = "$md_disk_mounted" ] && break
done
#

 

Has that something to do with unRaid beta I'm using? Thank you very much.

Link to comment

Joe L's advise was great to fix my go script issues as well - as always.

 

One item remains which is the part below:

 

#wait until all the configured disks are mounted
num_configured=`grep "disk[0-9]*=" /boot/config/disk.cfg | wc -l`
while sleep 5
do
md_disk_mounted=`mount | grep "/dev/md[0-9]*" | wc -l`
[ "$num_configured" = "$md_disk_mounted" ] && break
done
#

 

Has that something to do with unRaid beta I'm using? Thank you very much.

possibly.  I do not know if disk.cfg is still used in 5.0b6

 

Change this line from

num_configured=`grep "disk[0-9]*=" /boot/config/disk.cfg | wc -l`

to

num_configured=5

 

and it should work once more.  (replacing "5" with the actual number of data disks on your server)

Link to comment

Joe,

 

yes that is working very well. Seems that there are only minor remaining issues:

 

mount -t cifs //NSHDX03D5/music /mnt/user/HDX

is not working as it requires a password.

 

This following lines are there to disable SMB in Mac OSX Finder and the last command doesn't seem to work properly:

avahi-daemon -k
rm /etc/avahi/services/samba.service
avahi-daemon -D

 

And lastly the whole scaling governor thing doesn't seem to work http://lime-technology.com/forum/index.php?topic=12292.0

 

Any advise on these items?

Link to comment

 

This following lines are there to disable SMB in Mac OSX Finder and the last command doesn't seem to work properly:

Code:

avahi-daemon -k
rm /etc/avahi/services/samba.service
avahi-daemon -D

 

How does it not work exactly? Do you mean that avahi services are not started?

Link to comment

How does it not work exactly? Do you mean that avahi services are not started?

 

That is the issue - I don't want to have TOWER (=AFP) next to TOWER.SMB in the Finder as I'm using only AFP with the MAC, hence don't need the SMB part. There is a description here I followed but I seem to make something wrong

Link to comment

How does it not work exactly? Do you mean that avahi services are not started?

 

That is the issue - I don't want to have TOWER (=AFP) next to TOWER.SMB in the Finder as I'm using only AFP with the MAC, hence don't need the SMB part. There is a description here I followed but I seem to make something wrong

 

So nothing is happening. Do you still see both?

Link to comment

Well, there should be plenty of clues to determine how far execution of your go script gets.

 

I've got to assume that the 'readiness' beep doesn't happen.

 

Is cpufreq_ondemand loaded?

 

Does the mount of HDX happen?  .... etc.

 

Then you can try commenting out sections of the script in order to determine which section is failing, or you can try moving the SMB disable section higher up the file .....

Link to comment

PeterB, I think that is my only option. As said earlier here http://lime-technology.com/forum/index.php?topic=2946.msg121700#msg121700 the HDX mount doesn't happen as it requires a password and the whole cpufreq_ondemand section is a secret to me. I will comment that all out.

 

Thank you.

 

{EDIT:} I updated the go script and the server even beeps at the end  :)

The whole cool'n'quiet part is not resolved yet but might fit better in the respective area of the forum.....

 

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &
#
# unMENU
echo "/boot/unmenu/uu" | at now + 1 minute
#
cd /boot/packages && find . -name '*.auto_install' -type f -print | sort -r | xargs -n1 sh -c
sed -i "s/^short_open_tag = Off/short_open_tag = On/" /boot/custom/php/php.ini
#
# wait until all the configured disks are mounted
num_configured=5
while sleep 5
do
  md_disk_mounted=`mount | grep "/dev/md[0-9]*" | wc -l`
  [ "$num_configured" = "$md_disk_mounted" ] && break
done
#
# Set disk read-ahead 2048
for i in /dev/md*
do
blockdev --setra 2048 $i
done
#
# cpufreq support
# modprobe speedstep-lib
#
# Increase network performance
echo nameserver 192.168.178.1 >/etc/resolv.conf
echo 192.168.178.28 tower >>/etc/hosts
#
# Powerbutton clean shutdown
CTRLALTDEL=yes installpkg /boot/packages/powerdown-1.02-noarch-unRAID.tgz
[ -f /sbin/powerdown ] && mv /usr/local/sbin/powerdown /usr/local/sbin/unraid_powerdown
[ -f /sbin/powerdown ] && sed -i "sX/usr/local/sbin/powerdownX/sbin/powerdownX" /etc/acpi/acpi_handler.sh
[ ! -f /usr/local/sbin/unraid_powerdown ] && sed -i  "sX/sbin/init 0X/sbin/powerdownX" /etc/acpi/acpi_handler.sh
sysctl -w kernel.poweroff_cmd=/sbin/powerdown
#
# Naim HDX Backup
cp /boot/hdx_backup /etc/cron.daily
mount -t cifs -o password=secretpw //NSHDX03D5/music /mnt/user/HDX
#
# Powerdown at 23:00
# echo "/sbin/powerdown" | at 23:00
#
### CPU frequency scaling policies: http://lime-technology.com/forum/index.php?topic=12292.0
# Use the CPUFreq governor 'powersave' as default.  This sets the
# frequency statically to the lowest frequency supported by the CPU.
#/sbin/modprobe cpufreq_powersave
#
# Use the CPUFreq governor 'performance' as default. This sets the
# frequency statically to the highest frequency supported by the CPU.
#/sbin/modprobe cpufreq_performance
#
# Use the CPUFreq governor 'conservative' as default.  This allows you
# to get a full dynamic frequency capable system by simply loading your
# cpufreq low-level hardware driver.  Be aware that not all cpufreq
# drivers support the 'conservative' governor -- the fallback governor
# will be the 'performance' governor.
#/sbin/modprobe cpufreq_conservative
#
# Use the CPUFreq governor 'ondemand' as default.  This allows you to
# get a full dynamic frequency capable system by simply loading your
# cpufreq low-level hardware driver.  Be aware that not all cpufreq
# drivers support the 'ondemand' governor -- the fallback governor will
# be the performance governor.  This seems to be the most-recommended
# scaling policy, so rc.modules will try to load this by default.
# auskommentiert /sbin/modprobe cpufreq_ondemand 2>/dev/null
#
### CPU scaling governor:
#
# Set the default scaling_governor to be used (such as userspace or ondemand)
# if there is a CPUFreq scaling policy module loaded that supports it:
# SCALING_GOVERNOR=ondemand
#
# Try to enable the scaling_governor selected above:
# if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ]; then
#  if grep -wq "$SCALING_GOVERNOR" /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ; then
#    if [ -r /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
#      for SYSCPUFILE in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ; do
#        echo "$SCALING_GOVERNOR" > $SYSCPUFILE
#      done
#    fi
#  fi
# fi
#
# Disable SMB in Finder
avahi-daemon -k
rm /etc/avahi/services/samba.service
avahi-daemon -D
#
# Indicating readiness
beep -l 100 -r 5

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.