Last active
December 1, 2023 10:32
-
-
Save lukapaunovic/49f6a75d43331802025f2485c6e8291b to your computer and use it in GitHub Desktop.
(seeweb.it) Web Accelerator cache clearing.sh
This file contains hidden or 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
rm /var/www/vhosts/carocci.it/httpdocs/cache_status.txt | |
sleep 10 | |
sessionid=$(curl -s -A 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36' --data-raw 'username=vmXXXX&password=YeXXXX' -X POST 'https://cs.cloudcenter.seeweb.it/accounts/login' -c - | grep 'sessionid' | awk '{print $NF}') | |
csrftoken=$(curl -s 'https://cs.cloudcenter.seeweb.it/dashboard' -H 'Cookie: sessionid='$sessionid -H 'Referer: https://cloudcenter.seeweb.it/' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36' -c - | grep 'csrftoken' | grep -v jQuery | awk '{print $NF}') | |
curl -s -A 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36' -H 'Cookie: sessionid='$sessionid'; csrftoken='$csrftoken -H 'X-CSRFToken: '$csrftoken -H 'Referer: https://cs.cloudcenter.seeweb.it/webaccelerator/v2/webaccelerators/vm9372/' -X POST 'https://cs.cloudcenter.seeweb.it/webaccelerator/v2/webaccelerators/vm9372/restart/' > /var/www/vhosts/carocci.it/httpdocs/cache_status.txt | |
today=`date +%Y-%m-%d.%H:%M:%S` | |
echo $today >> /var/www/vhosts/carocci.it/httpdocs/cache_status.txt | |
PHP: | |
/** | |
* Clear Web Accelerator cache. | |
*/ | |
add_action( 'after_rocket_clean_domain', function() { | |
shell_exec('bash /var/www/vhosts/carocci.it/httpdocs/clear-cache.sh > /var/www/vhosts/carocci.it/httpdocs/cache_status.txt 2>&1 &'); | |
}); | |
add_action( 'after_rocket_clean_post', function() { | |
shell_exec('bash /var/www/vhosts/carocci.it/httpdocs/clear-cache.sh > /var/www/vhosts/carocci.it/httpdocs/cache_status.txt 2>&1 &'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment