for archive_command use an script rather than a command
You can put it wherever you like, so long as the postgres user has permission to execute it, and permission to cd into the directory it's in.

I usually put it in /usr/local/bin unless I'm working on a system that has a versioned repository of scripts, in which case it's in there - something like /opt/mycompany-scripts/postgresql/myarchivescript.sh.

I recommend using a fully qualified path to make its location obvious, e.g.

archive_command = '/usr/local/bin/pg_archive_wal.sh "%p" "%f"'


(calling it "backup script" is misleading; it isn't doing backups at all, it's just archiving WAL, which may be part of a backup or replication process).