#!/bin/bash # $Id: rhost,v 1.62 2023/08/23 21:49:45 fulford Exp fulford $ # $Source: /src/admin/usr/local/etc/RCS/rhost,v $ # $Release$ # Author C W Fulford. # Copyright 2013 (c) C W Fulford. All rights reserved. # For assistance contact fulford@fulford.net 0709 229 5385 ################################################################### cmd=`basename $0` syntax="$cmd [-c <config file>] [-d] [-fs #] [-l <login name>] [-t <TERM>] [-u <username>] [-v] [-X] [-Y] <hostname>\nor\n <hostname> [-c <config_file>] [-d] [-fs #] [-l <login_name>] [-t <TERM>] [-u <username>] [-v] [-X] [-Y] <hostname>" while [ $# -gt 0 ];do case $1 in -c) config=$2;shift 2;; -d) set -x;sshv="-v";debug=:;shift;; -fs) fsize=$2;shift;; -l) login=$2;shift 2;; -t) vterm=$2;shift 2;; -v) set -x;sshv="-v";shift;; -X | -Y ) xforward=$1;shift;; -*) echo -e $syntax >&2; exit;; *) host=$1;shift;; esac done config=${config:-/usr/local/etc/rhost.cf} bg=${bg:-yellow} fg=${fg:-blue} port=22 vterm=${vterm:-xterm} DISPLAY=${DISPLAY:-localhost:0.0} if ps -ef|grep -q xfwm4 ;then vterm=xfce4-terminal fi if [ -z $host ];then host=`basename $0` fi if [ $host = "host" ];then echo "$0: host not set connecting to localhost" >&2 host=localhost fi if [ -f "$config" ] ;then if grep "^$host:" $config >/dev/null 2>&1 ;then eval `sed -ne "/^$host:/,/^$/{ /^[ ][^#]/p }" $config` else echo "$cmd: $host not found in $config" >&2 fi else echo "$cmd: $config not found" >&2 fi para="-fn 10x20 -sb -sm -sl 4000" [ $xforward ] && spara="$spara -l $login" [ $verbose ] && echo $spara >&2 ping -c 1 -W 1 $host >/dev/null ||{ case $conn in vpn) vn-connect ${debug:+"-d"} $host;teardown="killall pppd";; telnet) $vterm -display $DISPLAY -bg $bg -fg $fg -T $host -geometry 80x24 -e "telnet $host $port";; pppd) sudo pppd call $domain;; esac } case $vterm in local) $vterm --display $DISPLAY -t $host --geometry=80x24 -e "ssh $sshv $spara -p $port $login $host";; lxterminal) $vterm --display $DISPLAY -t $host --geometry=80x24 -e "ssh $sshv $spara -p $port $login $host";; xterm) $vterm -display $DISPLAY -bg $bg $para -fg $fg -T $host -geometry 80x24 -e "export TERM=xterm;ssh $sshv $spara -p $port $host; [ -n "$wdir"] && cd $wdir" ;; terminal) $vterm --title=$host -e "ssh $sshv $login -p $port $host";; rdesktop) $vterm -g $geometry -d $domain -u $user -p "$passwd" $host;exit;; xfce4-terminal) $vterm --display $DISPLAY --color-bg=$bg --color-text=$fg -T $host -e "ssh $sshv $spara -p $port $host";; esac [ $teardown ] && $teardown ###################################################################### # This program is free software: you can redistribute it and or # # modify it under the terms of the Lesser GNU General Public License # # as published by the Free Software Foundation, either version 3 of # # the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # A copy of the Lesser GNU General Public License and the GNU # # General Public License is available at # # <http://www.gnu.org/licenses/>. # ######################################################################
Copyright
© 2003-2017
Clifford W Fulford.
Fulford Consulting Ltd.
Regd. Co. 4250037 in England & Wales.
Regd. office 162, Edward Rd. Nottingham NG2 5GF, England, UK.
Related web sites: City Linux | Flare Support | West Bridgford | Fulford Portal | Joan Mary Fulford (Nottingham Writer) | Fulford Gallery | Amharic Interpreter | Arabic Interpreter | Tigrinya Interpreter
The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.