[mosh-devel] mosh: how to resume after reboot?
Christoph Thielecke
christoph.thielecke at gmx.de
Tue Sep 11 06:23:24 EDT 2012
Hello Keith,
first, mosh is a great solution which I'm missed for a long time.
Now, its working but one piece I'm miss:
The possibility to resume mosh sessions on reboot.
I wrote a script (see below) which saves the mosh sessions (ip, port, key) and
generate a shell script for starting mosh-client with the env vars, ip and
port. But resume does not work. Could get it working? That would be great :)
script for save mosh sessions:
#!/bin/sh
MOSH_INSTANCE_STATE_FILE=~/.mosh_state
########################
INSTANCES_RUNNING=$(ps axu | egrep "^$USER" | grep mosh-client | grep -v grep)
OLD_IFS=$IFS
IFS=$'\n'
echo > "# mosh state created at $(date)" > $MOSH_INSTANCE_STATE_FILE
chmod 600 $MOSH_INSTANCE_STATE_FILE
echo >> $MOSH_INSTANCE_STATE_FILE
for INSTANCE in $INSTANCES_RUNNING; do
INSTANCE_PID=$(echo "$INSTANCE" | awk {'print $1'})
INSTANCE_KEY=$(cat /proc/$INSTANCE_PID/environ | tr "\000" "\n" | grep
MOSH_KEY | cut -f 2 -d '=')
INSTANCE_PREDICTION_DISPLAY=$(cat /proc/$INSTANCE_PID/environ |
tr "\000" "\n" | grep MOSH_PREDICTION_DISPLAY | cut -f 2 -d '=')
INSTANCE_HOST=$(echo "$INSTANCE" | awk {'print $8'})
INSTANCE_PORT=$(echo "$INSTANCE" | awk {'print $9'})
INSTANCE_SSH_USER=$(echo "$INSTANCE" | awk {'print $6'})
echo "export MOSH_KEY="$INSTANCE_KEY""
echo "export MOSH_PREDICTION_DISPLAY="$INSTANCE_PREDICTION_DISPLAY""
echo "mosh-client $INSTANCE_HOST $INSTANCE_PORT" >>
$MOSH_INSTANCE_STATE_FILE
done
unset MOSH_KEY
unset MOSH_PREDICTION_DISPLAY
IFS=$OLD_IFS
Mit freundlichen Grüßen
Christoph
--
Linux User Group Wernigerode
http://www.lug-wr.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.mit.edu/pipermail/mosh-devel/attachments/20120911/c2f11f64/attachment.bin
More information about the mosh-devel
mailing list