Go script delay


Recommended Posts

Is it possible to do a go script delay until after the array mounts?

 

IE.

 

#!/bin/bash

# Start the Management Utility

/usr/local/sbin/emhttp &

 

ifconfig eth1 up

sudo ifconfig eth1 192.168.1.11

 

sleep until array mounts

python /mnt/cache/.custom/sickbeard/Sick-Beard/SickBeard.py

Link to comment

Another consideration is that is that it's not a pause, it's a halt.

 

Here is what I use for now

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

 

This is another version I've been working on.

#!/bin/bash

[ ${DEBUG:=0} -gt 0 ] && set -x -v

declare -a CHAR=('+' 'x');
let i=0
let maxcount=60

DIR=/mnt/disk1

while ! read -n1 -t1 -p "Waiting for ${DIR} press ANY key to stop ($maxcount): [${CHAR[${i}]}]: "
do      echo -e "\r\c"
        [[ -d ${DIR}                   ]] && break
        [[ $(( maxcount-=1 )) -lt 1    ]] && break   
        [[ $(( i+=1 )) -ge ${#CHAR[@]} ]] && let i=0;
done
echo

echo "maxcount=$maxcount REPLY=${REPLY}"

 

 

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.