Skip to content

Instantly share code, notes, and snippets.

@Sroose
Created August 31, 2019 12:26
Show Gist options
  • Save Sroose/ca45e26c6754a93faec11970e84ee043 to your computer and use it in GitHub Desktop.
Save Sroose/ca45e26c6754a93faec11970e84ee043 to your computer and use it in GitHub Desktop.
Plesk cleanup script
#!/bin/bash
echo "CLEANING TEMPORARY PLESK UPDATE FILES"
echo "-------------------------------------"
echo
diskfree=`df / | awk '{ print $5 }' | tail -n 1`
echo "Current diskusage: " $diskfree
echo
echo "checking if plesk updater is not running.."
running=`ps aux | grep autoinstaller | grep -v "grep" | wc -l`
if [[ $running -gt 0 ]];then
echo "AUTO INSTALLER IS BUSY. STOPPING."
exit
fi
echo "ok"
echo
echo "checking if no backup tasks ongoing.."
working=`plesk sbin pmmcli --get-tasks-list Backup | grep working | wc -l`
if [[ $working -gt 0 ]];then
echo "BACKUP TASKS ONGOING. STOPPING."
exit
fi
echo "ok"
echo
echo "removing Plesk temporary files (/usr/local/psa/tmp/*)"
rm -rf /usr/local/psa/tmp/*
echo
diskfree=`df / | awk '{ print $5 }' | tail -n 1`
echo "Current diskusage: " $diskfree
echo "ALL DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment