use full paths for scripts

This commit is contained in:
Matthew Saunders Brown 2022-11-16 14:08:21 -08:00
parent 3422156801
commit de38c7fb1d
8 changed files with 20 additions and 20 deletions

View File

@ -16,20 +16,20 @@ sudo mv wp-cli.phar /usr/local/bin/wp
chmod +x /usr/local/bin/wp chmod +x /usr/local/bin/wp
# configure wp-cli bash completion # configure wp-cli bash completion
cp bash_completion.d/wp-cli /etc/bash_completion.d/ cp etc/bash_completion.d/wp-cli /etc/bash_completion.d/
chmod 644 /etc/bash_completion.d/wp-cli chmod 644 /etc/bash_completion.d/wp-cli
# install wp user scripts # install wp user scripts
cp bin/wp-* /usr/local/bin cp usr/local/bin/wp-* /usr/local/bin
chmod 755 /usr/local/bin/wp-* chmod 755 /usr/local/bin/wp-*
# install & enable wp systemd cron # install & enable wp systemd cron
cp sbin/wp-cron.sh /usr/local/sbin/ cp usr/local/sbin/wp-cron.sh /usr/local/sbin/
chmod 755 /usr/local/sbin/wp-cron.sh chmod 755 /usr/local/sbin/wp-cron.sh
if [[ ! -d /usr/local/lib/systemd/system ]]; then if [[ ! -d /usr/local/lib/systemd/system ]]; then
mkdir -p /usr/local/lib/systemd/system mkdir -p /usr/local/lib/systemd/system
fi fi
cp systemd/wp-cron.* /usr/local/lib/systemd/system/ cp usr/local/lib/systemd/system/wp-cron.* /usr/local/lib/systemd/system/
chmod 644 /usr/local/lib/systemd/system/wp-cron.* chmod 644 /usr/local/lib/systemd/system/wp-cron.*
systemctl enable wp-cron.timer systemctl enable wp-cron.timer
systemctl start wp-cron.timer systemctl start wp-cron.timer

View File

@ -14,48 +14,48 @@ else
fi fi
# update scripts in bin # update scripts in bin
chmod 755 bin/* chmod 755 usr/local/bin/*
readarray -t bin_script_array < <(ls -1 bin/) readarray -t bin_script_array < <(ls -1 usr/local/bin/)
for bin_script in "${bin_script_array[@]}"; do for bin_script in "${bin_script_array[@]}"; do
if [ -f /usr/local/bin/$bin_script ]; then if [ -f /usr/local/bin/$bin_script ]; then
if ! diff -q bin/$bin_script /usr/local/bin/$bin_script ; then if ! diff -q usr/local/bin/$bin_script /usr/local/bin/$bin_script ; then
echo "Updating /usr/local/bin/$bin_script" echo "Updating /usr/local/bin/$bin_script"
cp bin/$bin_script /usr/local/bin/$bin_script cp usr/local/bin/$bin_script /usr/local/bin/$bin_script
echo echo
fi fi
else else
echo "Adding new script /usr/local/bin/$bin_script" echo "Adding new script /usr/local/bin/$bin_script"
cp bin/$bin_script /usr/local/bin/$bin_script cp usr/local/bin/$bin_script /usr/local/bin/$bin_script
echo echo
fi fi
done done
# check bash completion config for update # check bash completion config for update
if ! diff -q bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli ; then if ! diff -q etc/bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli ; then
cp bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli cp etc/bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli
chmod 644 /etc/bash_completion.d/wp-cli chmod 644 /etc/bash_completion.d/wp-cli
echo "bash completion config updated" echo "bash completion config updated"
echo echo
fi fi
# check wp-cron.sh for update # check wp-cron.sh for update
if ! diff -q sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then if ! diff -q usr/local/sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then
cp sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh cp usr/local/sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh
chmod 755 /usr/local/sbin/wp-cron.sh chmod 755 /usr/local/sbin/wp-cron.sh
echo "sbin/wp-cron.sh updated" echo "wp-cron.sh updated"
echo echo
fi fi
# check systemd timer for update # check systemd timer for update
if ! diff -q systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service ; then if ! diff -q usr/local/lib/systemd/system/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service ; then
cp systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service cp usr/local/lib/systemd/systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service
chmod 644 /usr/local/lib/systemd/system/wp-cron.service chmod 644 /usr/local/lib/systemd/system/wp-cron.service
echo "systemd/wp-cron.service updated" echo "wp-cron.service updated"
echo echo
fi fi
if ! diff -q systemd/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer ; then if ! diff -q usr/local/lib/systemd/system/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer ; then
cp systemd/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer cp usr/local/lib/systemd/system/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer
chmod 644 /usr/local/lib/systemd/system/wp-cron.timer chmod 644 /usr/local/lib/systemd/system/wp-cron.timer
echo "systemd/wp-cron.timer updated" echo "wp-cron.timer updated"
echo echo
fi fi