diff --git a/repmgr.c b/repmgr.c index be5ca394..eb9d254c 100644 --- a/repmgr.c +++ b/repmgr.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -1762,11 +1763,18 @@ test_ssh_connection(char *host, char *remote_user) char script[MAXLEN]; int r; +/* On some OS, true is located in a different place than in Linux */ +#ifdef __FreeBSD__ +#define TRUEBIN_PATH "/usr/bin/true" +#else +#define TRUEBIN_PATH "/bin/true" +#endif + /* Check if we have ssh connectivity to host before trying to rsync */ if (!remote_user[0]) - maxlen_snprintf(script, "ssh -o Batchmode=yes %s /bin/true", host); + maxlen_snprintf(script, "ssh -o Batchmode=yes %s %s", host, TRUEBIN_PATH); else - maxlen_snprintf(script, "ssh -o Batchmode=yes %s -l %s /bin/true", host, remote_user); + maxlen_snprintf(script, "ssh -o Batchmode=yes %s -l %s %s", host, remote_user, TRUEBIN_PATH); log_debug(_("command is: %s"), script); r = system(script);