I've enabled the archive_mode with wal_level = hot_standby on a master server. I intended to send the wal logs to a nfs share with:
archive_command = 'test ! -f /mnt/psql_wal/%f && cp -i %p /mnt/psql_wal/%f'
But it keeps telling me this:
sh: /var/lib/pgsql/archive_wal.sh: Permission denied
LOG: archive command failed with exit code 126
DETAIL: The failed archive command was: test ! -f /mnt/psql_wal/000000010000000000000001 && cp -i pg_xlog/000000010000000000000001 /mnt/psql_wal/000000010000000000000001
cp: failed to access ‘/mnt/psql_wal/000000010000000000000001’: Permission denied
Basic nfs permissions issue, you may think, but no. The following command works:
sudo -H -u postgres cp -i /var/lib/pgsql/data/pg_xlog/000000010000000000000001 /mnt/psql_wal/000000010000000000000001
Is the archive command running under a different user?
777to path/mnt/psql_walto postgres user/var/lib/pgsql/archive_wal.shdoes come from and whether it has anything to do with the failure immediately below?test ! -f /mnt/psql_wal/000000010000000000000001 && cp -i pg_xlog/000000010000000000000001 /mnt/psql_wal/000000010000000000000001