June 17, 201016 yr I have my mover for my cache disk run every hour, and it bothered that every time it woke up my array drives, even when there was nothing to move. So added this little tweak; ... # If a previous invokation of this script is already running, exit if [ -f /var/run/mover.pid ]; then if ps h `cat /var/run/mover.pid` | grep mover ; then echo "mover already running" exit 0 fi fi # don't bother if there's only 1 entry (./) cd /mnt/cache lines=`find -depth -print|wc -l` if [ $lines == '1' ]; then echo "nothing to move" exit 0 fi echo $$ >/var/run/mover.pid echo "mover started" ... This way it will exit out if there's only 1 folder in /mnt/cache/ (the folder itself) I will elaborate on this in the morning, right now it's way past bedtime.
Archived
This topic is now archived and is closed to further replies.