On Tue, Feb 15, 2005 at 02:43:13PM -0500, James D. Freels wrote:
> I think I missed something here. The response below, where did it come
> from ? (about the sleep delays, etc.)
>
In an earlier message I noted that after a command like an mt or mtx,
my drive returned control to the caller before it was ready to accept
the next command. So a sequence like mt rewind; mtx slot 4 might fail
because the rewind was not quite finished. Thus sleep delays.
Eric suggested, quite correctly, that instead of a sleep for a fixed
time, a script, possibly called mtsync, like this would be better:
#!<some posix shell>
TapeDev=${1:-/dev/rmt/0ln}
Limit=${2:-120}
cnt=0
while (( cnt <= Limit ))
do
mt -f $TapeDev status > /dev/null 2>&1 && break
sleep 1
(( cnt = cnt + 1 ))
done
exit $(( cnt > Limit ? 1 : 0 ))
Untested, and assumes "mt status" returns 0 if drive is ready
and non-zero if not.
--
Jon H. LaBadie jon AT jgcomp DOT com
JG Computing
4455 Province Line Road (609) 252-0159
Princeton, NJ 08540-4322 (609) 683-7220 (fax)
|