summaryrefslogtreecommitdiff
path: root/remoteusage
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@finestructure.net>2012-04-14 22:04:13 -0700
committerJameson Graef Rollins <jrollins@finestructure.net>2012-04-14 22:04:13 -0700
commitaf8e2084e8bb1091169c00ed95dd9f0224d21078 (patch)
tree8de7ec9970181b1bfd0ed3eb9832e997324f40dd /remoteusage
parent35943c3f44c22af008c0f4bc30a273db67912648 (diff)
parent664815671a1134f9077b8103cf61c8b62ea0e490 (diff)
Merge branch 'master' of git://notmuchmail.org/git/notmuch-wiki
Diffstat (limited to 'remoteusage')
-rw-r--r--remoteusage/remotewrapper.mdwn29
1 files changed, 29 insertions, 0 deletions
diff --git a/remoteusage/remotewrapper.mdwn b/remoteusage/remotewrapper.mdwn
new file mode 100644
index 0000000..ba1daac
--- /dev/null
+++ b/remoteusage/remotewrapper.mdwn
@@ -0,0 +1,29 @@
+ #!/bin/bash
+
+ # Run notmuch on remote host over SSH
+ #
+ # http://notmuchmail.org/remoteusage/
+ #
+ # Put this script in your path and add (setq notmuch-command
+ # "notmuch-remote") to your emacs configuration.
+ #
+ # Add a host specification for "notmuch" to ~/.ssh/config to set the
+ # remote host and (optionally) remote user.
+ #
+ # Host notmuch
+ # HostName host.example.org
+ # User username
+
+ SSH_REMOTE_HOST=notmuch
+ SSH_CONTROL_PATH="-o ControlPath=/tmp/notmuch-remote.${USER}.%r@%h:%p"
+
+ # Start a background master connection if one isn't running yet
+ ssh ${SSH_CONTROL_PATH} -O check ${SSH_REMOTE_HOST} 2>/dev/null ||
+ ssh ${SSH_CONTROL_PATH} -MNf ${SSH_REMOTE_HOST}
+
+ # The ControlPersist option (in OpenSSH 5.6) could be used to start
+ # the master connection automatically when "ssh host notmuch" is run.
+
+ # This requires the bash version of printf (bashism)
+ printf -v ARGS "%q " "$@"
+ ssh ${SSH_CONTROL_PATH} ${SSH_REMOTE_HOST} notmuch ${ARGS}