Last active
October 25, 2021 03:32
-
-
Save adrian-green/b839b009e3775938cbba68a9c8ec897e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# adjust to suit | |
MODE=live | |
SITE=https://full.site.domain/ | |
WEBDIR=/srv/magento/${MODE}/www/pub/ | |
# generate a 20 char random file name (will be removed) | |
RANDOM_SCRIPT_NAME=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 20) | |
# write temp file | |
echo "<?php opcache_reset(); ?>" > ${WEBDIR}${RANDOM_SCRIPT_NAME}.php | |
# issue curl request to flush the opcache under web server context | |
curl http://${SITE}/${RANDOM_SCRIPT_NAME}.php | |
# clean up | |
rm ${WEBDIR}${RANDOM_SCRIPT_NAME}.php | |
echo "cache reset" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment