How do I correctly use %p and %f in postgresql.conf to make the Write Ahead Log?
You need to copy the WAL segment somewhere else, not to its original location.

&ldquo;Somewhere else&rdquo; in this context means different storage on a different physical machine. So cp is only a good method of archival if the destination is an NFS mount or similar. Otherwise, scp would be better.

You have to make as sure as you can that any trouble that befalls the original database won't affect the WAL archives.

It is also a good idea to test if the cp would overwrite anything, like the example in the documentation does. Otherwise, if two clusters archive to the same directory by mistake, you could end up with data loss.