Plesk System Maintenance: How The Command Line Helps Administrators

In this article we provide overview on how to manage Plesk through the command line and execute scripts or binaries on certain Plesk events. In addition, you will learn how to adjust Plesk settings to fit a new network environment or server configuration, and restart Plesk to apply new settings.

Managing Plesk Objects Through the Command Line

Plesk Command Line Interface (CLI) is designed for integrating Plesk with third-party applications. Plesk administrators can also use it to create, manage, and delete customer and domain accounts, and other Plesk objects from the command line. CLI utilities require administrative permissions on Plesk server to run.

The utilities reside in the following directories:

  • On RPM-based systems: /usr/local/psa/bin
  • On DEB-based systems: /opt/psa/bin

Upon successful execution, utilities return the 0 code. If an error occurs, utilities return code 1 and display the error details.

Executing Custom Scripts on Plesk Events

Plesk provides a mechanism that allows administrators to track specific Plesk events and make Plesk execute custom scripts when these events occur. The events include operations that Plesk users perform on accounts, subscriptions, websites, service plans, and various Plesk settings. For example, you can save each added IP address to a log file or perform other routine operations.

Changing IP Addresses in Plesk

During the lifetime of a Plesk server, you may need to change the IP addresses employed by Plesk. Two typical cases when IP addresses may need to be changed are the following:

  • Reorganization of the server IP pool. For example, substitution of one IP address with another.
  • Relocation of Plesk to another server. Changing all addresses used by Plesk (including the one on which Plesk resides) to those on the new server.

Every time the change happens, you should reconfigure all related system services. To help you do this promptly, we offer the reconfigurator command line utility located in the following directory:

  • on RPM-based systems: /usr/local/psa/bin.
  • on DEB-based systems: /opt/psa/bin.

The reconfigurator replaces IP addresses and modifies Plesk and services configuration to make the system work properly after the replacement. To do this, the utility requires a mapping file, that includes instructions on what changes to make. Each line of the file should describe a single change. For example, the following line instructs Plesk to change the IP address 192.168.50.60 to 192.168.50.61:

eth0:192.168.50.60 255.255.255.0 -> eth0:192.168.50.61 255.255.255.0

The utility also helps you with creation of the mapping file. If you call the utility with a new file name as an option, it will create the file and write all available IP addresses to it. The IP addresses in the file are mapped to themselves. If you want to perform a change, modify the change instruction for a certain IP address.

When editing the mapping file, consider the following:

  • A replacement IP address must not exist in the Plesk IP pool before changing; however, it may be in the server IP pool. To make sure the IP is not in the Plesk IP pool, go to Server Administration Panel> Tools & Settings > IP Addresses and remove the IP if necessary.
  • If a replacement IP address does not exist in the server IP pool, the utility adds it to both Plesk and server IP pools.

To change IP addresses used by Plesk:

  1. Generate a mapping file with current Plesk IP addresses by running the command:
  2. ./reconfigurator <ip_map_file_name>
  3. Edit the file as described above and save it.
  4. Reconfigure Plesk and its services by running the following command one more time:

./reconfigurator <ip_map_file_name>

Changing Paths to Services

Plesk uses various external components, for example, Apache web server, mail service, antivirus, and so on. When interacting with these components, Plesk gets the information on their locations from the configuration file /etc/psa/psa.conf.

Plesk configuration file provides an easy way of reconfiguring Plesk if a service is installed into another directory or migrated from the current partition to another. Note that you can only modify paths present in this file; other paths are hard-coded in Plesk components.

Each line of psa.conf has the following format:

<variable_name> <value>

A sample part of the psa.conf file is displayed below. To change a path to a service, utility, or package, specify the new path as a value of a corresponding variable.

# Plesk tree

PRODUCT_ROOT_D /usr/local/psa 

# Directory of SysV-like Plesk initscripts

PRODUCT_RC_D /etc/init.d # Directory for config filesPRODUCT_ETC_D /usr/local/psa/etc 

# Directory for service utilities

PLESK_LIBEXEC_DIR /usr/lib/plesk-9.0 

# Virtual hosts directory

HTTPD_VHOSTS_D /var/www/vhosts 

# Apache configuration files directory

HTTPD_CONF_D /etc/httpd/conf 

# Apache include files directory

HTTPD_INCLUDE_D /etc/httpd/conf.d 

# Apache binary

HTTPD_BIN /usr/sbin/httpd

#Apache log files directory

HTTPD_LOG_D /var/log/httpd 

#apache startup script

HTTPD_SERVICE httpd 

# Qmail directory

QMAIL_ROOT_D /var/qmail

Note: Be very careful when changing the contents of psa.conf. Mistakes in paths specified in this file may lead to Plesk malfunctioning.

Restarting Plesk

If you experience problems with Plesk, for example, malfunctioning of a service, you can try to resolve them by restarting Plesk or the administrative web server sw-cp-server. Also, a restart is necessary to apply configuration changes that cannot be made while Plesk is running.

To restart Plesk, run the following command:

/etc/init.d/psa restart

To restart sw-cp-server, run the following command:

/etc/init.d/sw-cp-server restart

Managing Services from the Command Line and Viewing Service Logs

Here we explain how to stop, start, and restart services managed by Panel, and access their logs and configuration files.

Plesk web interface

To start the service through the command line:

/etc/init.d/psa start

To stop the service through the command line:

/etc/init.d/psa stop

To restart the service through the command line:

/etc/init.d/psa restart

Plesk log files are located in the following directories:

  • Error Log: /var/log/sw-cp-server/error_log
  • Access log: /var/log/plesk/httpsd_access_log

Panel configuration files are the following:

  • php: $PRODUCT_ROOT_D/admin/conf/php.ini
  • www: /etc/sw-cp-server/applications.d/plesk.conf

Presence Builder

Log files are located in:

  • Error log: /var/log/httpd/sitebuilder_error.log
  • Logs: /usr/local/sitebuilder/tmp/

Configuration files are accessible at:

  • /usr/local/sitebuilder/config
  • /usr/local/sitebuilder/etc/php.ini

phpMyAdmin

The error log is located in: /var/log/sw-cp-server/error_log

The configuration file is accessible at: /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php

phpPGAdmin

The error log is located in: /var/log/sw-cp-server/error_log

The configuration file is accessible at: /usr/local/psa/admin/htdocs/domains/databases/phpPgAdmin/conf/config.inc.php

Courier-IMAP

To start the service through the command line:

/etc/init.d/courier-imap start

To stop the service through the command line:

/etc/init.d/courier-imap stop

To restart the service through the command line:

/etc/init.d/courier-imap restart

Log files are located in: /var/log/plesk/maillog

Configuration files are accessible at:

  • /etc/courier-imap/imapd
  • /etc/courier-imap/imapd-ssl
  • /etc/courier-imap/pop3d
  • /etc/courier-imap/pop3d-ssl

DNS / Named / BIND

To start the service through the command line:

/etc/init.d/named start

To stop the service through the command line:

/etc/init.d/named stop

To restart the service through the command line:

/etc/init.d/named restart

Log files are located in: /var/log/messages

The configuration file is accessible at: /etc/named.conf

FTP (ProFTPD)

Log files are located in: /var/log/plesk/xferlog

Configuration files are accessible at:

  • /etc/xinetd.d/ftp_psa
  • /etc/proftpd.conf
  • /etc/proftpd.include

Postfix

To start the service through the command line:

/etc/init.d/postfix start

To stop the service through the command line:

/etc/init.d/postfix stop

To restart the service through the command line:

/etc/init.d/postfix restart

Log files are located in: /var/log/plesk/maillog

Configuration files are accessible at: /etc/postfix/

QMail

To start the service through the command line:

/etc/init.d/qmail start

To stop the service through the command line:

/etc/init.d/qmail stop

To restart the service through the command line:

/etc/init.d/qmail restart

Log files are located in: /var/log/plesk/maillog

Configuration files are accessible at:

  • /etc/xinetd.d/smtp_psa
  • /etc/xinetd.d/smtps_psa
  • /etc/xinetd.d/submission_psa
  • /etc/inetd.conf(Debians)
  • /var/qmail/control/

SpamAssassin

To start the service through the command line:

/etc/init.d/psa-spamassassin start

To stop the service through the command line:

/etc/init.d/psa-spamassassin stop

To restart the service through the command line:

/etc/init.d/psa-spamassassin restart

Log files are located in: /var/log/plesk/maillog

Configuration files are accessible at:

  • /etc/mail/spamassassin/
  • /etc/mail/spamassassin/local.cf
  • /var/qmail/mailnames/%d/%l/.spamassassin

Kaspersky antivirus

To start the service through the command line:

service kavehost start

To stop the service through the command line:

service kavehost stop

To restart the service through the command line:

service kavehost restart

Log files are located in:

  • /var/log/maillog
  • /var/log/mail.log

Configuration files are accessible at:

/opt/kav/sdk8l3/etc

Odin Premium Antivirus

To start the service through the command line:

/etc/init.d/drwebd start

To stop the service through the command line:

/etc/init.d/drwebd stop

To restart the service through the command line:

/etc/init.d/drwebd restart

Log files are located in: /var/log/plesk/maillog

Configuration files are accessible at: /etc/drweb/

Tomcat

To start the service through the command line:

/etc/init.d/tomcat5 start

To stop the service through the command line:

/etc/init.d/tomcat5 stop

To restart the service through the command line:

/etc/init.d/tomcat5 restart

Log files are located in: /var/log/tomcat5/

Configuration files are accessible at: /usr/share/tomcat5/conf/

MySQL

To start the service through the command line:

/etc/init.d/mysqld start

To stop the service through the command line:

/etc/init.d/mysqld stop

To restart the service through the command line:

/etc/init.d/mysqld restart

Log file is located in: /var/log/mysqld.log

The configuration file is accessible at: /etc/my.cnf

PostgreSQL

To start the service through the command line:

/etc/init.d/postgresql start

To stop the service through the command line:

/etc/init.d/postgresql stop

To restart the service through the command line:

/etc/init.d/postgresql restart

Startup log is located in: /var/lib/pgsql/pgstartup.log

The configuration file is accessible at: /var/lib/pgsql/data/postgresql.conf

xinetd

To start the service through the command line:

/etc/init.d/xinetd start

To stop the service through the command line:

/etc/init.d/xinetd stop

To restart the service through the command line:

/etc/init.d/xinetd restart

Log files are located in: /var/log/messages/

The configuration file is accessible at: /etc/xinetd.conf

Watchdog (monit)

To start the service through the command line:

/usr/local/psa/admin/bin/modules/watchdog/wd --start

To stop the service through the command line:

/usr/local/psa/admin/bin/modules/watchdog/wd --stop

To restart the service through the command line:

/usr/local/psa/admin/bin/modules/watchdog/wd --restart

Log files are located in:

  • /var/log/plesk/modules/watchdog/log/wdcollect.log
  • /var/log/plesk/modules/watchdog/log/monit.log

Configuration files are accessible at:

  • /usr/local/psa/etc/modules/watchdog/monitrc
  • /usr/local/psa/etc/modules/watchdog/wdcollect.inc.php

Watchdog (rkhunter)

Log is located in: /var/log/rkhunter.log

The configuration file is accessible at: /usr/local/psa/etc/modules/watchdog/rkhunter.conf

Apache

To start the service through the command line:

/etc/init.d/httpd start

To stop the service through the command line:

/etc/init.d/httpd stop

To restart the service through the command line:

/etc/init.d/httpd restart

Log files are located in:

  • /var/log/httpd/
  • /var/www/vhosts/<domain_name >/statistics/logs/

Configuration files are accessible at:

  • /etc/httpd/conf/httpd.conf
  • /etc/httpd/conf.d/
  • /var/www/vhosts/<domain_name >/conf/httpd.include

Mailman

To start the service through the command line:

/etc/init.d/mailman start

To stop the service through the command line:

/etc/init.d/mailman stop

To restart the service through the command line:

/etc/init.d/mailman restart

Log files are located in: /var/log/mailman/

Configuration files are accessible at:

  • /etc/httpd/conf.d/mailman.conf
  • /usr/lib/mailman/Mailman/mm_cfg.py
  • /etc/mailman/sitelist.cfg

Webalizer

To start the service through the command line:

/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php

Configuration files are accessible at:

/var/www/vhosts/<domain_name>/conf/webalizer.conf

AWstats

To start the service through the command line:

/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php

Configuration files are accessible at:

/usr/local/psa/etc/awstats/

Backup Manager

Backup logs are located in:

  • /var/log/plesk/PMM/sessions/<session>/psadump.log
  • /var/log/plesk/PMM/sessions/<session>/migration.log
  • /var/log/plesk/PMM/logs/migration.log
  • /var/log/plesk/PMM/logs/pmmcli.log

Restore logs are located in:

  • /var/log/plesk/PMM/rsessions/<session>/conflicts.log
  • /var/log/plesk/PMM/rsessions/<session>/migration.log
  • /var/log/plesk/PMM/logs/migration.log
  • /var/log/plesk/PMM/logs/pmmcli.log

The configuration file is accessible at:

/etc/psa/psa.conf

Plesk Migration Manager

Migration logs are located in:

  • /var/log/plesk/PMM/msessions/<session>/migration.log
  • /var/log/plesk/PMM/rsessions/<session>/migration.log
  • /var/log/plesk/PMM/rsessions/<session>/conflicts.log
  • /var/log/plesk/PMM/logs/migration.log
  • /var/log/plesk/PMM/logs/pmmcli.log
  • /var/log/plesk/PMM/logs/migration_handler.log

Horde

Log is located in:

/var/log/psa-horde/psa-horde.log

Configuration files are accessible at:

  • Apache configuration
    • /etc/httpd/conf.d/zzz_horde_vhost.conf
    • /etc/psa-webmail/horde/conf.d/
  • Horde configuration:

·         /etc/psa-webmail/horde/

Atmail

Log files are located in:

/var/log/atmail/

Configuration files are accessible at:

  • Apache configuration
    • /etc/httpd/conf.d/zzz_atmail_vhost.conf
    • /etc/psa-webmail/atmail/conf.d/
  • Atmail configuration:
    • /etc/psa-webmail/atmail/atmail.conf
    • /var/www/atmail/libs/Atmail/Config.php

psa-firewall

To start the service through the command line:

/etc/init.d/psa-firewall start

To stop the service through the command line:

/etc/init.d/psa-firewall stop

To restart the service through the command line:

/etc/init.d/psa-firewall restart

Configuration files are accessible at:

  • /usr/local/psa/var/modules/firewall/firewall-active.sh
  • /usr/local/psa/var/modules/firewall/firewall-emergency.sh
  • /usr/local/psa/var/modules/firewall/firewall-new.sh

psa-firewall (IP forwarding)

To start the service through the command line:

/etc/init.d/psa-firewall-forward start

To stop the service through the command line:

/etc/init.d/psa-firewall-forward stop

To restart the service through the command line:

/etc/init.d/psa-firewall-forward restart

Configuration files are accessible at:

  • /usr/local/psa/var/modules/firewall/ip_forward.active
  • /usr/local/psa/var/modules/firewall/ip_forward.saved

Moving the Plesk GUI to a Separate IP Address

By default, the Plesk GUI can work on all IP addresses available on the Plesk server (from the server’s IP pool). You may want to allow access to the Plesk GUI only from the local network. For that, you should move the GUI to an internal IP address.

To move Plesk GUI to a separate IP address, in the configuration file /etc/sw-cp-server/conf.d/plesk.conf, replace the lines

listen 8443 ssllisten 8880;

with the lines

listen SPECIFIC_SERVER_IP:8443 ssllisten SPECIFIC_SERVER_IP:8880;

where SPECIFIC_SERVER_IP is the new IP address that you want to use for the Plesk GUI.

Do not change the ports.

Setting Off Automatic Integration of WordPress Installations

If you are using the WP Toolkit extension, it detects new installations performed through the Application Catalog (or Application Vault) and integrates them with WP Toolkit. For this reason, installation of WordPress on a site takes up to 20 seconds. If you want to avoid this, you can switch off automatic detection of new installations by the WP Toolkit.

To do this, add the following lines to the panel.ini file :

[ext-wp-toolkit]

autoAttachApsInstances = off

Turning Off WP Toolkit

If you are using the WP Toolkit extension, you can completely switch it off on your server.

To switch off WP Toolkit, add the following lines to the panel.ini file:

[ext-wp-toolkit]

enabled=off

No comment yet, add your voice below!

Add a Comment

Your email address will not be published. Required fields are marked *

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! WebPros International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the WebPros Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to [email protected] or use the unsubscribe link in any of the newsletters.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden

Related Posts

Knowledge Base

Plesk uses LiveChat system (3rd party).

By proceeding below, I hereby agree to use LiveChat as an external third party technology. This may involve a transfer of my personal data (e.g. IP Address) to third parties in- or outside of Europe. For more information, please see our Privacy Policy.

Search
Generic filters
Exact matches only
Search in title
Search in content
Search in excerpt