First we need to install wp-cli. In depth instructions can be found at wp-cli
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
IMPORTANT: The scripts must not be ran as root!
We can also embed a Youtube video like so:
[embedyt] https://www.youtube.com/watch?v=xcenCCdNF0U [/embedyt]
Create a file named wp_crontab_list.sh
with the following content:
#!/bin/bash
PATH_TO_WORDPRESS="/var/www/html"
wp cron event list --path="$PATH_TO_WORDPRESS"
Create another file named wp_crontab_run.sh
with the following content:
#!/bin/bash
PATH_TO_WORDPRESS="/var/www/html"
# Fix write/execute permissions prior to running cron
sudo find "$PATH_TO_WORDPRESS" -type d -exec chmod 775 {} \;
sudo find "$PATH_TO_WORDPRESS" -type f -exec chmod 664 {} \;
wp cron event run --all --due-now --path="$PATH_TO_WORDPRESS"
# Fix ownership permissions after running cron tasks since the generated files are owned by the user running this script
sudo chown -R www-data:www-data $PATH_TO_WORDPRESS
On the user chosen to run these scripts, crontab -e
and add the following:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/5 * * * * /bin/bash /home/cionescu/wp_crontab_run.sh >/dev/null 2>&1
Finally, to disable the WP built-in cron edit wp-config.php
and near the bottom add the following:
/* Add any custom values between this line and the "stop editing" line. */
// We disable built-in cron since we're running system wide one in shell
define('DISABLE_WP_CRON', true);
JavaScript
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function onClickEffect(btn, style) {
btn.removeClass("btn-light");
btn.addClass(style);
await sleep(250);
btn.removeClass(style);
btn.addClass("btn-light");
}
JSON
{
"text": " Experience proves this.",
"segments": [{
"id": 0,
"seek": 0,
"start": 0.0,
"end": 2.0,
"text": " Experience proves this.",
"tokens": [50364, 28503, 25019, 341, 13, 50464],
"temperature": 0.0,
"avg_logprob": -0.4622415815080915,
"compression_ratio": 0.7419354838709677,
"no_speech_prob": 0.03434836119413376}],
"language": "en"
}
Shell Script
#!/bin/sh
mkdir /media/NexusBackups/files/
ls -la .
rsync -avz --partial --progress --no-owner --no-group --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --exclude='/proc' --exclude='/dev' --exclude='/sys' --exclude='/mnt' --exclude='/media' --exclude='/lost+found' --exclude='/boot' --exclude='/swapfile' --exclude='/run' --exclude='/tmp' -e ssh nexus:/ /media/NexusBackups/files/