Avoiding Disasters With Plesk Repair Utility
Plesk features a self-repair facility that automatically enables you to find the source of and the resolution to a range of Plesk issues. Experiencing a problem with a Plesk service? Is your e-mail not working, or do some of your website fail to load? The Plesk repair utility can help you solve these problems. You can even fix problems with Plesk itself, including error messages in Plesk or problems loading Plesk in the first place. Always try using the Plesk repair utility first to try to solve or repair Plesk problems.
Plesk repair can automatically check and if necessary repair individual Plesk aspects – or even all your Plesk services, all at the same time.To run the Plesk repair utility, log in to the server via SSH (if you are using Plesk for Linux), or RDP (if you are using Plesk for Windows), and run the plesk repair command, specifying the desired flag and options:
plesk repair FLAG [OPTION]
You have three choices or modes when you start Plesk repair:
- Plesk’s repair utility can often automatically detect issues even before you realise there is a problem. When it does that it will prompt you and ask for your permission to run a repair. Plesk repair will also prompt you if it is going to reconfigure a service – also asking you for your permission. Interactive mode is the default mode for the Plesk repair utility. Note that some fixes can only be performed in Interactive mode, for example if you are resolving an issue with a missing PHP handler. This is because some tasks require that you choose from a list of options. These operations are marked in the descriptions alongside the operations.
- When running in Diagnostic mode the utility simply detects issues, but it won’t be able to repair the issues that it finds. You can run the utility in diagnostic mode by running the command: plesk repair and adding the -y option.
- Unlike Diagnostic mode, Repair mode can fix issues and it will do so automatically, fixing any issue it finds during diagnostics. It will also reconfigure services where necessary even if it does not detect a problem. Run Repair mode by executing plesk repair, including a -y option.
Don’t forget to specify one of the following if you need to (for more information on each flag, click on it to see an expanded explanation including options specific to each flag and examples of its use).
- all – This aspect includes all the aspects below.
- mail – This aspect diagnoses and troubleshoots issues with the mail server.
- web – This aspect diagnoses and troubleshoots issues with the web server.
- dns – This aspect diagnoses and troubleshoots issues with the DNS server.
- ftp – This aspect diagnoses and troubleshoots issues with the FTP server.
- db – This aspect diagnoses and troubleshoots issues with the Plesk database.
- fs – This aspect diagnoses and troubleshoots issues with the file system.
- mysql – This aspect diagnoses and troubleshoots issues with MySQL.
- mssql – This aspect diagnoses and troubleshoots issues with Microsoft SQL Server.
- installation – This aspect diagnoses and troubleshoots issues with Plesk itself.
Note that extended output is available for some operations. You add the -v option when running plesk repair to get extended output.
Some issues are more serious than others. While the Plesk repair utility dialogises Plesk it will report back either an ERROR or a WARNING. The utility will return a “0” if all detected issues are only at the WARNING level or if it detects no issues. If any single issue is at the ERROR level the utility will report back a “1”. You can tweak the error code: if you want the utility to report “1” if at least WARNING is detected you can request that by adding the option -treat-warnings-as-errors when you run plesk repair.
To get help for the plesk repair utility, run the plesk repair command with the help(or the –help)option:
plesk help repair
plesk --help repair
To get help for any particular aspect of the utility, run the same command with specifying the aspect:
plesk help repair [ASPECT]
plesk --help repair [ASPECT]
For example, the plesk repair help mail command will display help for the mail aspect.
Plesk Repair Utility: All
If you want to run every single check you should specify the all flag. All checks everything included under every other flag. Plesk repair all will do a complete and full check of every aspect of your server. Keep in mind that if you have a lot of domains on your server running plesk repair all will take a long time to execute, while increasing server load. Under these circumstances we recommend running plesk repair all during quiet hours.
- plesk repair all: Run this command to check the Plesk installation and all Plesk services. You will automatically be in Interactive mode so when an issue is detected you will be prompted for your permission to fix the issue.
- plesk repair all -y: also checks everything about Plesk, but the -y option means that the utility will run in Repair mode, automatically fixing anything it detects as faulty.
- plesk repair all -n: add the -n option if you only want to run Plesk repair in diagnostic mode. The -n option will check all aspects of the Plesk installation and services and inform you of any issues it detects. -n will not resolve any issues.
Plesk Repair Utility: Mail
You can reconfigure mail settings for all domains and mailboxes by running the Plesk repair utility with the mail flag. You can customize the mail flag by adding any of the following flags:
- -restore-configuration: With this option you instruct the Plesk utility to restore the default configuration for the mail server. Plesk checks your mail server configuration every 24 hours and makes a snapshot of this configuration if it detects a change. Using -restore-configuration means that Plesk backs up your current configuration files. You are then offered a list of the available snapshots and the associated dates. Next, you can select the snapshot you want to restore. This option is only available in interactive mode, and only on Linux.
- -only-domain-settings: add this tag if you only want to reconfigure the mail settings for your domains, without making any changes to mailbox settings. Only available on Linux.
- -dont-restore-password: Use this option for specific mailboxes and domains, and only on Windows. This option reconfigures mail settings but does not synchronize the mailbox passwords between the mail server and the Plesk database.
When you run the repair utility you can specify that only specific domains or specific mailboxes are reconfigured.
Examples of restricting configuration to specific domains and mailboxes:
- plesk repair mail – Run this command and you will reconfigure the mail settings for every mailbox under every domain. This command runs in Interactive mode – whenever an issue is detected you will be prompted for your permission to resolve the issue.
- plesk repair mail mysuperbmail.com – Reconfigure the mail settings for all mailboxes belonging to the example.com domain, as well as domain-wide mail settings.
- plesk repair mail [email protected] – Reconfigure the mail settings for the [email protected] mailbox.
Plesk Repair Utility: Web
When you use the Plesk repair utility with the web flag you regenerate the configuration files for your web server and for every domain. This flag also gives you the option to reinstall SSL certificates and will also resolve any issues with corrupt or missing PHP handlers. You can further customise this flag by adding any of the following options at the end:
- -domains-only: only regenerate the configuration files for domains.
- -sslcerts: configures all server IP addresses to use the default SSL certificate. Also reinstalls every SSL certificate in use.
- -filesharing: Refers to Plesk database and updates the file containing sharing passwords and permission for authorised users.
- -webmail: Windows-only, this reconfigures the webmail site inside of IIS
- -validate-configuration: Linux-only, this option validates the Apache configuration
- -server: Linux-only, this option regenerates the Apache configuration file
- -php-handlers: For unregistered PHP handlers, this option triggers a check for the service plans and domains. Only applicable in interactive mode.
You can specify individual domains to regenerate the configuration for the specified domains only.
- plesk repair web – Regenerate the configuration files for the web server and all domains.
- plesk repair web -server – Regenerate the configuration files for the web server only.
- plesk repair web -domains-only – Regenerate the configuration files for domains only.
- plesk repair web mysuperbweb.com – Regenerate the configuration files for the example.com domain only.
- plesk repair web -sslcerts – Reinstall all SSL certificates and configure all IP addresses to use the default SSL certificate.
Plesk Repair Utility: DNS
Using the Plesk repair utility with the dns aspect synchronizes the DNS zones information between the DNS server and the Plesk database. The following options are specific to this aspect:
- -sync-zones – Performs the synchronization without confirmation. Acts identically to -y.
- plesk repair dns – Synchronizes the DNS zones information between the DNS server and the Plesk database.
Plesk Repair Utility: FTP
Another very useful Plesk repair utility flag is the ftp flag. Ftp checks system users and the associated directories for consistency. With ftp you have the following additional options you can specify:
- -sys-users: Linux-only, this is a consistency check for system users.
- -host-name: Specific to Windows, this option checks that the host name is no longer than 15 symbols.
- -root-dir: Specific to Windows, this option checks that the root path for FTP does not have any characters that are “spaces” and that the root paths exists on the file system
- -domains-resolving: Checks that domain names resolve to the appropriate IP addresses (Windows only).
- -home-dir: Checks the home directories of additional FTP users (Windows only).
- -junctions: Checks that FTP home junctions exist and point to the home directories of corresponding users (Windows only).
- plesk repair ftp – Check the system users and their directories for consistency.
Plesk Repair Utility: File System
If you are concerned about file structure integrity you should use the fs flag. The Plesk repair utility will check system files, especially system files critical to Plesk, plus virtual hosts files on your server when you use the fs flag. Optionally you can specify that only certain domains are checked.
Important: The fs flag is only applicable to Plesk repair installations on Linux machines.
When you run the repair utility with the fs flag you are able to detect and repair the following issues:
- File and directory owners that are not proper
- File and directory permissions that are not proper
- File and directory extended attributes that are not proper
Running the repair utility with the fs flag will also detect any mandatory files and mandatory directories that are not present. However, these cannot be fixed automatically.
The fs flag can be further customised by adding one of the following options:
- -system: Forces the utility to only check system files, including system files critical for the operation of Plesk
- -vhosts: Forces the utility to only check the files of virtual hosts
Should none of the above options be included, the utility will simply check both system files and virtual hosts’ files.
Should an individual domain name be specified the utility will only check files for this domain. When a specific domain is specified additional options including -system and -vhosts will be ignored.
- plesk repair fs – Check both the virtual hosts’ files and the system files on the server.
- plesk repair fs -vhosts – Check only the virtual hosts’ files on the server.
- plesk repair fs –system – Check only the system files on the server.
- plesk repair fs superbhost.com – Check the files of the superbhost.com virtual host only.
- plesk repair fs superbhost.com -vhosts – Check the files of the superbhost.com virtual host only. In this case the –vhosts option is ignored.
- plesk repair fs –system –v –n – Give the detailed information about any detected issues of the system files, but do not resolve them.
Plesk Repair Utility: Plesk Database
Check the Plesk database for consistency by using the Plesk repair utility in conjunction with the db flag. The db flag check both system tools and tools specific to Plesk. If the tool finds any issues it will create a database dump and attempt to correct the problems with the database. There are no further flags or options that can be specified alongside db.
- plesk repair db – Check the Plesk database for consistency.
Plesk Repair Utility: File System
Check validity of virtual hosts’ directories and directory structures using the fs flag. The fs flag will also recreate directories that are missing and will correct permissions. The flag fs allows you to specify individual domains to be checked. There are no further options for this flag.
- plesk repair fs – Check the integrity of the virtual hosts’ directories and their structure.
- plesk repair fs mysuperbhost.com – Check the integrity and structure of mysuperbhost.com virtual host directories.
Plesk Repair Utility: MySQL
The mysql flag checks the availability of MySQL databases and will verify the integrity of MySQL databases and the database users. You have the following additional options with this flag:
- -connection: Verifies that MySQL database servers that are registered with Plesk are available and that connectivity is live.
- -databases: Verifies that every MySQL database created in Plesk exists on the database servers and recreates any missing databases.
- -database-users: Verifies that the MySQL database users created in Plesk exist on database servers. This options also checks that user privileges are correct, fixing any incorrect privileges. This option also recreates users that are missing from databases.
- plesk repair mysql – Check the availability of MySQL database servers and verify the integrity of MySQL databases and database users.
- plesk repair mysql -connection – Check that the MySQL database servers registered in Plesk are available and can be connected to.
- plesk repair mysql -database-users – Check that all MySQL database users created in Plesk exist on the database servers. Checks database users’ privileges and corrects them in case of discrepancies. Recreates any database users that are missing.
Plesk Repair Utility: Microsoft SQL Server
Using the Plesk repair utility with the mssql option checks Microsoft SQL Server database servers while also verifying the validity of Microsoft SQL Server database users and the actual databases. The following options applies and can be specified next to this flag:
- plesk repair mssql: Use this flag to verify the validity of Microsoft SQL servers and verify the integrity of every Microsoft SQL database and its users
- plesk repair mssql -connection: Use this option to verify that Microsoft SQL databases are registered in Plesk, and that these databases are available.
- plesk repair mssql -database-users: Use this option to verify that every Microsoft SQL database user that is in Plesk also exist on the database server. This option also verifies that user privileges are correct and fixes any problems with user privileges. Any database users that are missing are recreated.
- plesk repair mssql – Check the availability of Microsoft SQL database servers and verify the integrity of Microsoft SQL databases and database users.
- plesk repair mssql -connection – Check that the Microsoft SQL database servers registered in Plesk are available and can be connected to.
- plesk repair mssql -database-users – Check that all Microsoft SQL database users created in Plesk exist on the database servers. Checks database users’ privileges and corrects them in case of discrepancies. Recreates any database users that are missing.
Plesk Repair Utility: Installation
The installation flag in the Plesk repair utility will check the consistency of the actual Plesk installation. This flag should be used if you are experiencing problems with Plesk itself and not one of the individual Plesk services. This flag does not have any additional options.
- plesk repair installation – Check the consistency of the Plesk installation.