plesk db "INSERT INTO cp_access (type, netaddr, netmask) VALUES ('deny','10.10.10.1','255.255.252.0');"
Author: admin
Load updates from the developer repositories
echo "10.52.3.135 autoinstall.plesk.com" >> /etc/hosts
Install Plesk without micro-updates
./plesk-installer --select-release-id RELEASE --skip-patch
List of releases can be retrieved via:
./plesk-installer --show-releases
Import .sql files from current directory to MySQL
M_P=$(cat /etc/psa/.psa.shadow); for db in *.sql; do echo "Restoring ${db::-4}"; MYSQL_PWD=$M_P mysql -uadmin < "$db"; done
Dump all databases to separate files
M_P=$(cat /etc/psa/.psa.shadow); D_C="dump_on_$(date '+%F-%H:%M')"; mkdir "$D_C" && for db in $(MYSQL_PWD=$M_P mysql -uadmin -Nse 'SHOW DATABASES'); do MYSQL_PWD=$M_P mysqldump -uadmin -R --skip-extended-insert "$db" > "$D_C$db.sql"; done
Get list of DKIM status for all domains
plesk db "SELECT d.name AS 'Subscription', IF (p.value = 'true', 'Enabled', 'Disabled') AS 'DKIM Status' FROM domains d LEFT JOIN DomainServices ds ON d.id = ds.dom_id LEFT JOIN (SELECT * FROM Parameters WHERE parameter = 'domain_keys_sign') p ON ds.parameters_id = p.id WHERE ds.type = 'mail';"
Restore correct ownership on a domain folder and all its contents
INFO=($(MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -sN -e'SELECT h.www_root,s.login FROM domains d, hosting h, sys_users s WHERE s.id=h.sys_user_id AND h.dom_id=d.id AND d.name="example.com"')); chown -R ${INFO[1]}:psacln ${INFO[0]}; chown ${INFO[1]}:psaserv ${INFO[0]}
Starting from Plesk 17.8 it can be done easier
plesk repair fs example.com
List passwords for all mailboxes
plesk sbin mail_auth_view
Create a backup of psa database with an insert on each line
This could be useful for debugging via diff -u (better using vimdiff if installed)
MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysqldump -uadmin --skip-extended-insert psa > psa_dump_on_"$(date '+%F-%H:%M')".sql
Load MySQL/MariaDB with “skip-grant-tables” without editing configuration
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" systemctl restart mysql systemctl unset-environment MYSQLD_OPTS systemctl restart mysql