Step 1:
open file config rsync
$ vi /etc/xinetd.d/rsync
service rsync
{
disable = no
#flags = IPv6
socket_type = stream
wait = no
user = root
server = /opt/rsync_trigger.sh # change /usr/bin/rsync to /path/to/script
server_args = --daemon
log_on_failure += USERID
}
Step 2:
save code php to file
$ vi reset_cached.php
<?php
opcache_reset();
?>
Step 3:
Go to path to script. eg: /opt/rsync_trigger.sh
$ vi /opt/rsync_trigger.sh
#!/bin/bash
/usr/bin/rsync "$*"
/usr/bin/curl http://localhost/reset_cached.php
#or option 2
#/usr/local/bin/php /var/www/reset_cached.php
# or option 3
#/usr/local/bin/php -r 'opcache_reset();'