I have a script that copy files to another server. I don't want to overwrite any files so I have to use rsync.
I can use rsync without any problem when I run at command line. But when I use it in script, rsync does not work. It gives an error and I even could not find that error at Google.
Here is error:
rsync: Failed to exec ssh: Not a directory (20)
rsync error: error in IPC code (code 14) at pipe.c(84) [sender=3.0.9]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in IPC code (code 14) at io.c(605) [sender=3.0.9]
I would like to point that error is not No such file or directory(2)
Error is: Not a directory(20)
Here is script:
#!/bin/bash
PATH=$1
FILE=$2
DAY=$(/usr/bin/date +'%Y-%m-%d')
/usr/bin/rsync -avh $PATH postgres@REMOTE_IP:/Backup/xlog_backup/$DAY/.
I am using like this
sh ~postgres/archive.sh /srv/postgresql/data/pg_xlog/000000010000003E00000025 000000010000003E00000025
Here is ls output:
postgres@MY_SERVER:~$ls -l /srv/postgresql/data/pg_xlog/000000010000003E00000025
-rw-------. 1 postgres postgres 16777216 May 25 10:41 /srv/postgresql/data/pg_xlog/000000010000003E00000025
Server: CentOS Linux release 7.2.1511 (Core)
Rsync: rsync version 3.0.9 protocol version 30
postgres@MY_SERVER:~$rpm -qa | grep openssh
openssh-clients-6.6.1p1-22.el7.x86_64
openssh-server-6.6.1p1-22.el7.x86_64
openssh-6.6.1p1-22.el7.x86_64
rsync-3.0.9-17.el7.x86_64
Could you help me to solve the problem?