rconnect: support -t timeout for aan like in drawterm; also rcpu, rexport/import
This commit is contained in:
parent
05f721e998
commit
17291d91bb
4 changed files with 13 additions and 11 deletions
|
@ -2,8 +2,9 @@
|
||||||
rfork e
|
rfork e
|
||||||
|
|
||||||
argv0=$0
|
argv0=$0
|
||||||
|
aanto=86400 #one day
|
||||||
fn usage {
|
fn usage {
|
||||||
echo 'usage:' $argv0 '[-u user] [-k keypattern] [-p] host remotescript localcommand arg ...' >[1=2]
|
echo 'usage:' $argv0 '[-u user] [-k keypattern] [-p] [-t timeout] host remotescript localcommand arg ...' >[1=2]
|
||||||
exit 'usage'
|
exit 'usage'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ while(~ $1 -*){
|
||||||
switch($1){
|
switch($1){
|
||||||
case -k; keyspec=($keyspec $2)
|
case -k; keyspec=($keyspec $2)
|
||||||
case -u; keyspec=($keyspec `{user=$2 pvar user})
|
case -u; keyspec=($keyspec `{user=$2 pvar user})
|
||||||
|
case -t; aanto=$2
|
||||||
case *; usage
|
case *; usage
|
||||||
}
|
}
|
||||||
shift
|
shift
|
||||||
|
@ -53,14 +55,14 @@ if(~ $filter aan){
|
||||||
echo -n 'announce *!0' >[1=3]
|
echo -n 'announce *!0' >[1=3]
|
||||||
echo `{cat $netdir/local} || exit
|
echo `{cat $netdir/local} || exit
|
||||||
bind '#|' /mnt/aan || exit
|
bind '#|' /mnt/aan || exit
|
||||||
exec aan $netdir <>/mnt/aan/data1 >[1=0] >[2]/dev/null &
|
exec aan -m $aanto $netdir <>/mnt/aan/data1 >[1=0] >[2]/dev/null &
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<>/mnt/aan/data >[1=0] >[2]/dev/null {
|
<>/mnt/aan/data >[1=0] >[2]/dev/null {
|
||||||
rfork n
|
rfork n
|
||||||
fn server {
|
fn server {
|
||||||
echo -n aanserver $netdir >/proc/$pid/args
|
echo -n aanserver $netdir >/proc/$pid/args
|
||||||
rm -f /env/^('fn#server' 'fn#aanserver')
|
rm -f /env/^('fn#server' 'fn#aanserver' 'aanto')
|
||||||
. <{n=`{read} && ! ~ $#n 0 && read -c $n} >[2=1]
|
. <{n=`{read} && ! ~ $#n 0 && read -c $n} >[2=1]
|
||||||
}
|
}
|
||||||
exec tlssrv -A /bin/rc -c server
|
exec tlssrv -A /bin/rc -c server
|
||||||
|
@ -69,9 +71,9 @@ if(~ $filter aan){
|
||||||
}
|
}
|
||||||
fn aanclient {
|
fn aanclient {
|
||||||
host=`{echo $host | sed 's/(.*)!([^!]+)$/\1/'}^!^`{read | sed 's/(.*)!([^!]+)$/\2/'} || exit
|
host=`{echo $host | sed 's/(.*)!([^!]+)$/\1/'}^!^`{read | sed 's/(.*)!([^!]+)$/\2/'} || exit
|
||||||
tlsclient -a -o <>{rfork s; aan -c $host >[1=0]} /bin/rc -c 'sendscript $*' $*
|
tlsclient -a -o <>{rfork s; aan -m $aanto -c $host >[1=0]} /bin/rc -c 'sendscript $*' $*
|
||||||
}
|
}
|
||||||
exec $argv0 -k $"keyspec $host <{builtin whatis aanserver; echo aanserver} aanclient $*
|
exec $argv0 -k $"keyspec $host <{builtin whatis aanserver; pvar aanto; echo aanserver} aanclient $*
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ rfork e
|
||||||
|
|
||||||
argv0=$0
|
argv0=$0
|
||||||
fn usage {
|
fn usage {
|
||||||
echo 'usage:' $argv0 '[-u user] [-k keypattern] [-P patternfile] [-p] [-h host] [-c cmd arg ...]' >[1=2]
|
echo 'usage:' $argv0 '[-u user] [-k keypattern] [-P patternfile] [-p] [-t timeout] [-h host] [-c cmd arg ...]' >[1=2]
|
||||||
exit 'usage'
|
exit 'usage'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ while(~ $1 -*){
|
||||||
~ $#* 1 && usage
|
~ $#* 1 && usage
|
||||||
switch($1){
|
switch($1){
|
||||||
case -P; exportfs=($exportfs $1 $2)
|
case -P; exportfs=($exportfs $1 $2)
|
||||||
case -[uk]; connect=($connect $1 $2)
|
case -[ukt]; connect=($connect $1 $2)
|
||||||
case -h; host=$2
|
case -h; host=$2
|
||||||
case -c; cmd=$*(2-); *=()
|
case -c; cmd=$*(2-); *=()
|
||||||
case *; usage
|
case *; usage
|
||||||
|
|
|
@ -3,7 +3,7 @@ rfork e
|
||||||
|
|
||||||
argv0=$0
|
argv0=$0
|
||||||
fn usage {
|
fn usage {
|
||||||
echo 'usage:' $argv0 '[-abcCnq] [-s remotename] [-m remotemtpt] [-u user] [-k keypattern] [-P patternfile] [-p] tree host [remotecmd [args ...]]' >[1=2]
|
echo 'usage:' $argv0 '[-abcCnq] [-s remotename] [-m remotemtpt] [-u user] [-k keypattern] [-P patternfile] [-p] [-t timeout] tree host [remotecmd [args ...]]' >[1=2]
|
||||||
exit 'usage'
|
exit 'usage'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ while(~ $1 -*){
|
||||||
~ $#* 1 && usage
|
~ $#* 1 && usage
|
||||||
switch($1){
|
switch($1){
|
||||||
case -P; exportfs=($exportfs $1 $2)
|
case -P; exportfs=($exportfs $1 $2)
|
||||||
case -[uk]; connect=($connect $1 $2)
|
case -[ukt]; connect=($connect $1 $2)
|
||||||
case -s; sname=`{basename $2}
|
case -s; sname=`{basename $2}
|
||||||
case -m; mtpt=$2
|
case -m; mtpt=$2
|
||||||
case *; usage
|
case *; usage
|
||||||
|
|
|
@ -3,7 +3,7 @@ rfork e
|
||||||
|
|
||||||
argv0=$0
|
argv0=$0
|
||||||
fn usage {
|
fn usage {
|
||||||
echo 'usage:' $argv0 '[-abcCnq] [-s name] [-u user] [-k keypattern] [-p] host tree [mountpoint]' >[1=2]
|
echo 'usage:' $argv0 '[-abcCnq] [-s name] [-u user] [-k keypattern] [-p] [-t timeout] host tree [mountpoint]' >[1=2]
|
||||||
exit 'usage'
|
exit 'usage'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ while(~ $1 -*){
|
||||||
case *
|
case *
|
||||||
~ $#* 1 && usage
|
~ $#* 1 && usage
|
||||||
switch($1){
|
switch($1){
|
||||||
case -[uk]; connect=($connect $1 $2)
|
case -[ukt]; connect=($connect $1 $2)
|
||||||
case -s; sname=`{basename $2}
|
case -s; sname=`{basename $2}
|
||||||
case *; usage
|
case *; usage
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue