I use the following within a homebrew backup script to loop until a tape has been loaded:
while [ `mt-st -f /dev/nst0 status | grep -c "ONLINE"` != 1 ]; do
Works like a charm when the script is run manually in a terminal. When started via cron however, the loop condition is never met. I can verify that the tape drive is online from an independent session, yet every 30 minutes a new instance of sleep is spawned instead of the script carrying on.
What am I missing?