]> git.cworth.org Git - obsolete/notmuch-wiki/commitdiff
master connection doc
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 2 Apr 2013 20:37:02 +0000 (23:37 +0300)
committerTomi Ollila <tomi.ollila@iki.fi>
Tue, 2 Apr 2013 20:37:10 +0000 (23:37 +0300)
remoteusage/aboriginal.mdwn

index a558044f1771486a2bf03897223c64fbbe5656a2..ccaded1c6101895c9416d5372f4790fb602b2170 100644 (file)
@@ -11,6 +11,9 @@ its own connection. As long as master ssh connection is live, slave
 can use it. Disconnecting master all future attempts to connect
 from the script will fail.
 
 can use it. Disconnecting master all future attempts to connect
 from the script will fail.
 
+At the end of this document there is information for some possible ways
+how master ssh connection can be done.
+
 ## The script
 
 Write the following code to a file, for example `remote-notmuch.sh`.
 ## The script
 
 Write the following code to a file, for example `remote-notmuch.sh`.
@@ -65,12 +68,12 @@ address `0.1` is invalid this attempt will fail early.
 Easiest way to test this script is to run the pre-made ssh connection
 using the following command line:
 
 Easiest way to test this script is to run the pre-made ssh connection
 using the following command line:
 
-        ssh -M -S '~'/.ssh/master-user@host:22 [user@]remotehost
+        ssh -M -S '~'/.ssh/master-user@host:22 [user@]remotehost sleep 600
 
 (replace `[user@]remotehost` with your login info). Doing this the
 
 (replace `[user@]remotehost` with your login info). Doing this the
-above script can be run unmodified. After the above command has been
-run on one terminal, enter `chmod +x remote-notmuch.sh` in another
-terminal and then test the script with `./remote-notmuch.sh help`
+above wrapper script can be run unmodified. After the above command has
+been run on **one terminal**, enter `chmod +x remote-notmuch.sh` in
+**another terminal** and then test the script with `./remote-notmuch.sh help`
 
 Note that the '~' is inside single quotes for a reason. In this
 case shell never expand it to `$HOME` -- ssh does it by not reading
 
 Note that the '~' is inside single quotes for a reason. In this
 case shell never expand it to `$HOME` -- ssh does it by not reading
@@ -102,3 +105,31 @@ to the `./remote-notmuch.sh` wrapper script testing with
 
 See the section *Configure Emacs on the client computer* in
 [[remoteusage|remoteusage]] how to do this. The instructions are the same.
 
 See the section *Configure Emacs on the client computer* in
 [[remoteusage|remoteusage]] how to do this. The instructions are the same.
+
+
+## Creating master connection
+
+As mentioned so many times, using this solution requires one pre-made
+ssh connection in "master" mode. The simplest way is to dedicate one
+terminal for the connection with shell access to the remote machine:
+
+        ssh -M -S '~'/.ssh/master-user@host:22 [user@]remotehost
+
+One possibility is to have this dedicated terminal in a way that the
+connection has (for example 1 hour) timeout:
+
+        ssh -M -S '~'/.ssh/master-user@host:22 [user@]remotehost sleep 3600
+
+The above holds the terminal. The next alternative puts the command in
+background:
+
+        ssh -f -M -S '~'/.ssh/master-user@host:22 [user@]remotehost sleep 3600
+
+If you don't want this to timeout so soon, use a longer sleep, like 99999999
+(8 9:s, 1157 days, a bit more than 3 years).
+
+A more "exotic" solution would be to make a shell script running on remote
+machine, checking/inotifying when new mail arrives. When mail arrives it
+could send message back to local host, where a graphical client (to be written)
+pops up on display providing info about received mail (and exiting this
+graphical client connection to remote host is terminated).