Hi,

today I had a try to setup dirvish with forced commands. I found a nice
wrapper script to provide different commands to the backup host.

<snip>
#!/bin/sh
# Author: Andreas Nitsche
# Script: /usr/local/bin/ssh-wrapper.sh
# TODO:
# - Use DIRVISH variables in front of command

# SETUP:
# add ssh key to ~/.ssh/authorized_keys file with this forced command
options:
#
command="/usr/local/bin/ssh-wrapper.sh",no-port-forwarding,no-X11-forwarding,no-pty
ssh-rsa ...

CLEAN_CMD=`echo $SSH_ORIGINAL_COMMAND | sed -r 's/DIRVISH[A-Z_]*=[^\
]*//g' | sed -r 's/cd\ ;//' | sed -r 's/^\s*|\s*$//'`
case "$CLEAN_CMD" in
    "backup")
        [ -x /usr/bin/automysqlbackup ] && /usr/bin/automysqlbackup >
/var/log/automysqlbackup.log
        ;;
    "rsync --server --sender -vlHogDtpre.iLs --numeric-ids . /")
        rsync --server --sender -vlHogDtpre.iLs --numeric-ids . /
        ;;
    *)
        date >> /var/log/ssh-wrapper.log
        echo "SSH_ORIGINAL_COMMAND: $SSH_ORIGINAL_COMMAND" >>
/var/log/ssh-wrapper.log
        echo "CLEAN_CMD: $CLEAN_CMD" >> /var/log/ssh-wrapper.log
        echo "Sorry. Only these commands are available to you:"
        echo "backup"
        exit 1
        ;;
esac

exit 0
</snip>

At the bottom I do have some debugging code in the script to check what
dirvish is doing when I set "pre-client: backup" in my config file for
this vault. It does execute a "cd ; <multiple dirvish environment
variables> backup" in a later version of this script I'd like to export
these variables in the script to be able to use them if needed.

Until this point everything was quite ok. When it comes to the rsync
command rsync complains about protocol incompatibility. The message I
see in the rsync_error file is:

<snip>
*** Execution cycle 0 ***

protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(171)
[receiver=3.0.6]
</snip>

Can you tell me what's the problem here? I didn't find a solution to
allow multiple commands some pre configured and some with just the base
command like rsync. It should not be possible to add command divided by
a semicolon.

Does somebody have a hint or have already solved this?

kind Regards
Andi

-- 
sixhop.net

sixhop.net
Andreas Nitsche
Pucher Str. 21-23
82256 Fürstenfeldbruck

Fon: 08141 31 597-0
Fax: 08141 31 597-1
E-Mail: i...@sixhop.net <mailto:i...@sixhop.net>
Web: www.sixhop.net <http://www.sixhop.net/>

_______________________________________________
Dirvish mailing list
Dirvish@dirvish.org
http://www.dirvish.org/mailman/listinfo/dirvish

Reply via email to