Bulk Change Internet Internet hosting & Mail Settings Rapidly and Simply with Plesk CLI

2. Listing of Enterprise Objects to be Configured

An inventory of enterprise objects to be processed by your loop, e.g. domains, can merely be written manually line by line as a textual content file or generated from the Plesk database by a Plesk CLI command or a database question. However the record can be an export from different knowledge sources reminiscent of a spreadsheet software.

The Tedious Handbook Manner

For instance, you would use a textual content editor to put in writing domains or e-mail addresses line by line in a textual content file. Both with the Home windows textual content editor, a spreadsheet whose strains you export as a textual content file and add to the server, with the Linux “vi” or “nano” editors, or in every other conceivable manner. Solely watch that every entry stands alone in a line of the textual content file, e.g.


Plenty of effort to put in writing this by hand. Due to this fact, usually, you’ll have a listing created routinely, e.g. by a database question or a Plesk CLI command.

The Easy Plesk Command Manner

Possibly you want a listing of all web sites. For this you would use “plesk bin website –record” and save the end result to a file by way of output redirection “>”.

# plesk bin website --list > web sites.txt

Or perhaps you wish to make bulk modifications to mailbox configurations. For this you would run the command “plesk bin mail -l” (present all mail addresses) and filter the end result with a “grep ‘Mail identify’” to get solely the mailboxes. You then’d solely need the third column (as a result of that’s the mail field identify), so that you add “awk ‘{print $3}’”, and at last you save the end result to a file utilizing output redirection “>”:

# plesk bin mail -l | grep "Mail identify"| awk '{print $3}' > mailboxes.txt

Working With Database Queries Like a Professional

Some duties may be extra advanced. You might solely need a record of mailboxes that match sure standards. To do that, you would generate the record of things from a database question and filter it by standards. For instance, a listing of all mailboxes may very well be generated as follows as an alternative of utilizing the “plesk bin mail” command:

# plesk db -Ne "SELECT CONCAT_WS('@', a.mail_name, b.identify) FROM psa.mail AS a 
INNER JOIN psa.domains as b ON b.id = a.dom_id WHERE a.postbox LIKE 'true';"
> mailboxes.txt

There you would insert arbitrary situations, e.g. solely all mailboxes whose identify begins with “x”:

# plesk db -Ne "SELECT CONCAT_WS('@', a.mail_name, b.identify) FROM psa.mail AS a 
INNER JOIN psa.domains as b ON b.id = a.dom_id WHERE a.postbox LIKE 'true'
AND a.mail_name LIKE 'x%';" > mailboxes_starting_with_a.txt

There aren’t any limits to your creativeness. With Plesk, this and way more is feasible, since you all the time have full entry to all knowledge managed by Plesk. In the event you plan to make use of database queries, the “psa” database is the place to search for all of your Plesk enterprise objects and configurations.