mirror of https://gogs.blitter.com/RLabs/xs
Added example openrc init script
Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
parent
d973c83e01
commit
d28a4af924
|
@ -358,8 +358,12 @@ func parseNonSwitchArgs(a []string) (user, host, path string, isDest bool, other
|
|||
func launchTuns(conn *hkexnet.Conn, remoteHost string, tuns string) {
|
||||
remAddrs, _ := net.LookupHost(remoteHost)
|
||||
|
||||
if tuns == "" {
|
||||
return
|
||||
}
|
||||
|
||||
tunSpecs := strings.Split(tuns, ",")
|
||||
for _,tunItem := range tunSpecs {
|
||||
for _, tunItem := range tunSpecs {
|
||||
var lPort, rPort uint16
|
||||
_, _ = fmt.Sscanf(tunItem, "%d:%d", &lPort, &rPort)
|
||||
reqTunnel(conn, lPort, remAddrs[0], rPort)
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
SVCNAME=hkexshd
|
||||
HKEXSHD_PIDFILE=/var/run/hkexshd.pid
|
||||
HKEXSHD_USER=root
|
||||
HKEXSHD_HOME=/var/run
|
||||
INST_PREFIX=/usr/local
|
||||
COMMAND=$INST_PREFIX/sbin/hkexshd
|
||||
ARGS=""
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
if [ ! -f "$COMMAND" ] ; then
|
||||
eerror "$COMMAND not installed" || return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig || return 1
|
||||
|
||||
ebegin "Starting ${SVCNAME}"
|
||||
start-stop-daemon \
|
||||
-d ${HKEXSHD_HOME} \
|
||||
--make-pidfile --pidfile ${HKEXSHD_PIDFILE} \
|
||||
--start --quiet --background \
|
||||
--exec "${COMMAND}" "${ARGS}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping ${SVCNAME}"
|
||||
start-stop-daemon --stop --quiet --pidfile $HKEXSHD_PIDFILE
|
||||
eend $?
|
||||
}
|
|
@ -26,9 +26,9 @@ import (
|
|||
"syscall"
|
||||
|
||||
"blitter.com/go/goutmp"
|
||||
"blitter.com/go/hkexsh/logger"
|
||||
hkexsh "blitter.com/go/hkexsh"
|
||||
"blitter.com/go/hkexsh/hkexnet"
|
||||
"blitter.com/go/hkexsh/logger"
|
||||
"github.com/kr/pty"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue