ISPmanager console commands: mgrctl and panel files

All commands are run over SSH as root on the VPS. mgrctl is the console interface to panel functions: the same as the buttons, but from the terminal.

Panel: restart, update, configs

CommandWhat it does
/usr/local/mgr5/sbin/mgrctl -m ispmgr exitrestart the panel (same as killall core). Needed after editing ispmgr.conf
systemctl restart ihttpdrestart the panel web server (port 1500). Needed after editing ihttpd.conf
/usr/local/mgr5/sbin/pkgupgrade.sh coremanagerupdate the panel core
nano /usr/local/mgr5/etc/ispmgr.confpanel settings
nano /usr/local/mgr5/etc/ihttpd.confpanel address, port, certificate and timeout

Domains, sites, owners

/usr/local/mgr5/sbin/mgrctl -m ispmgr domain | sed -e 's/displayname=.*user/user/' -e 's/dtype.*//'
# name=example.com user=www-root

/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain | sed -e 's/docroot.*//'
# name=example.com owner=www-root

Without sed all fields are shown. Suspend a site (elid is the name from the webdomain list):

/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain.suspend elid=example.com
/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain.resume elid=example.com

Passwords

# panel user
/usr/local/mgr5/sbin/mgrctl -m ispmgr user.edit elid=demo passwd='NewPassword' confirm='NewPassword' sok=ok

# FTP user
/usr/local/mgr5/sbin/mgrctl -m ispmgr ftp.user.edit elid=demo passwd='NewPassword' confirm='NewPassword' sok=ok

# one password for all panel users (e.g. after a hack — then give each user their own)
for u in $(/usr/local/mgr5/sbin/mgrctl -m ispmgr user | sed 's/=/ /' | awk '{print $2}'); do
  /usr/local/mgr5/sbin/mgrctl -m ispmgr user.edit elid=$u passwd='NewPassword' confirm='NewPassword' sok=ok
done

Keep the password in single quotes — then the characters $ ! & do not break the command.

Panel access by IP

# allow a user to log in only from one IP
/usr/local/mgr5/sbin/mgrctl -m ispmgr usrparam su=demo addr='198.51.100.7' atype=atallow sok=ok elid=demo

Locked yourself out with an IP restriction — remove the Access line from /usr/local/mgr5/var/userconf/ispmgr.root (for a user — ispmgr.<login>) and restart the panel.

Backups

cd /usr/local/mgr5 && ./sbin/backup2 demo          # copy of user demo
/usr/local/mgr5/sbin/cron-ispmgr sbin/backup2_pro demo   # the same in the Business edition

Temporary backup files — /usr/local/mgr5/var/backup/ispmgr/. Backups to our server: VPS backups.

Cron: open a site URL on schedule

If a CMS asks to "call a URL by cron" rather than a file, the job command is:

wget --no-check-certificate -O - -q -t 1 https://example.com/cron.php

-O - — do not save files to disk, -q — quiet, -t 1 — one try.

A long import from another server breaks

With a slow connection or a big volume the user import breaks on the session timeout. On the source server temporarily increase the timeouts:

# /usr/local/mgr5/etc/ispmgr.conf
AuthenLifeTime 1000000
NodeTimeoutSmall 36000
NodeTimeoutMiddle 36000
NodeTimeoutLong 36000
NodeTimeoutVeryLong 38000

# /usr/local/mgr5/etc/ihttpd.conf — inside the listen { ... } block
timeout 1000000
systemctl restart ihttpd && /usr/local/mgr5/sbin/mgrctl -m ispmgr exit

If the source panel could not enable SSH for the users being moved, enable it manually and run the import again. Revert the defaults afterwards. Import: Import from another server.

Questions and answers
/usr/local/mgr5/sbin/mgrctl -m ispmgr exit or killall core.
/usr/local/mgr5/sbin/mgrctl -m ispmgr webdomain | sed -e 's/docroot.*//'
The shell substitutes a variable. Put the password in single quotes.