#!/bin/sh self=`basename $0` openTime="22000d" [ "$1" ] || { cat <&2 Hold specified port or file open -- 12/10/17 brent@mbari.org Usage: $self {openTime} First argument is the port or file to hold open Remaining args are passed to the 'sleep' command If openTime is omitted, the port or file is held open forever (i.e. $openTime) Examples: $self /dev/ttyA6 #hold ttyA6 open forever $self /dev/ttyA6 1h 30m #hold ttyA6 open for 1hr and 30 minutes Note: Close the port with: fuser -k EOS exit 2 } portFile=$1 [ -r "$portFile" ] || { echo "$0: Cannot read $portFile" >&2 exit 1 } shift [ "$2" ] || set $openTime nohup sh -c "exec sleep $* <$portFile" >/dev/null 2>&1 &