Apparently I can't do that via Postgres.
So I've made a bash script to do the work for me.
The script will only delete the wal_files older than 24h ( -mmin +1440 )
* It has been tested and it's working.
recovery.conf:
archive_cleanup_command = 'exec nice -n 19 ionice -c 2 -n 7 ../archivecleaup_mv.bash -d "../wal_archive" "%r"'
archivecleaup_mv.bash:
#!/bin/bash -eudeclare -r -x PATH='/usr/local/bin:/usr/bin:/bin';ARCHIVEDIR='/var/lib/pgsql/9.2/wal_archive/'CHKPOINT=$(find $ARCHIVEDIR -type f -mmin +1440 -name '00*' -printf '%f\n' | sort -r | head -1)#cd $ARCHIVEDIRexec "/usr/pgsql-9.2/bin/pg_archivecleanup" $ARCHIVEDIR $CHKPOINT;find $ARCHIVEDIR -type f -mmin +1440 -a -name '00*' -a ! -newer $CHKPOINT -delete