September 20, 20169 yr My array is currently offline as I'm investigating an issue with one of the disks. I noticed that one of my seedbox sync scripts still runs and runs amuck because the array isn't online and it starts creating folders within /mnt/user. This leads me to the question of how do I get a script to check for array being up correctly before it executes? IOW, if the array is down, I want to abort the script.
September 20, 20169 yr Don't know if this is what you want, but hopefully you can derive something from this bash script piece. # Check if array is started ls /mnt/disk[1-9]* 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then echo "ERROR: Array must be started before using this script" exit fi
September 20, 20169 yr Don't know if this is what you want, but hopefully you can derive something from this bash script piece. # Check if array is started ls /mnt/disk[1-9]* 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then echo "ERROR: Array must be started before using this script" exit fi Funny.... I was going to have him parse vars.ini, and never thought about a simple check for directory existing. Simple solutions are usually the best
September 20, 20169 yr Author Don't know if this is what you want, but hopefully you can derive something from this bash script piece. # Check if array is started ls /mnt/disk[1-9]* 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then echo "ERROR: Array must be started before using this script" exit fi Is checking for the disks enough? Any reason why I couldn't just check for /mnt/user existing? e.g. if [ -d "/mnt/user"] <do something> else <do something else> fi
September 20, 20169 yr I can't take any credit, I took it from others scripts! Is checking for the disks enough? Any reason why I couldn't just check for /mnt/user existing? Checking for the disks is enough to know if the array is started. Checking for /mnt/user is also fine, *if* you know the user has User Shares enabled. If they don't, there won't be a /mnt/user, ever. I don't have it in my system.
Archived
This topic is now archived and is closed to further replies.