How to set expiration date for all subscriptions to unlimited via command line?
Answer
For Windows:
For Plesk Obsidian:
-
Connect to the server via RDP and retrieve domain names from the database:
C:> plesk db -Ne “select name from domains where webspace_id=0;” > webspaces_list.txt
-
Run the following command to set expiration date of all subscriptions to unlimited:
C:> for /f %i in (webspaces_list.txt) do “%plesk_cli%subscription_settings.exe” -u %i -expiration -1
Note: The list of domains
webspaces_list.txt
can be edited to change the expiration date for a bunch of certain domains.
For Plesk 11 and newer:
-
Connect to the server via RDP and retrieve domain names from the database
C:> cd %plesk_dir%MySQLbin
mysql -uadmin -p -P8306 psa -Ne”select name from domains where webspace_id=0;” > С:webspaces_list.txt -
Run the following command to set expiration date of all subscriptions to unlimited:
C:> for /f %i in (C:webspaces_list.txt) do “%plesk_cli%subscription_settings.exe” -u %i -expiration -1
For Linux:
Connect to the server via SSH and run the following commands:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -e”select name from domains where webspace_id=0;” | grep -v “name” > /tmp/webspaces.list
# while read l; do /usr/local/psa/bin/subscription_settings -u $l -expiration -1; done < /tmp/webspaces.list
Note: The list of domains webspaces.list
can be edited to change the expiration date for a bunch of certain domains.