# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa # /usr/local/psa/bin/domain ... # /usr/local/psa/bin/sw-engine-pleskrun /usr/local... # tail -f /var/log/sw-cp-server/error_log ...
plesk
", which was designed to simplify the execution of a number of frequent operations in the CLI. The utility comes as standard Plesk 11.5.
ls
(there are many options, but the command is one), and examples of command suites are git
or svn
(there are many subcommands).
/usr/local/psa/bin/
. I don't really want to type the prefix /usr/local/psa/bin/
each time. Do " cd /usr/local/psa/bin/
" too. Cramming /usr/local/psa/bin/
in PATH is an even less nice idea, because there will be chaos in PATH and it will be impossible to understand whether this is a standard utility or a utility from Plesk. Throwing out the old CLI interface and writing a completely new one over the coming weekend is utopian both in terms of time and in terms of backward compatibility. The logical answer to this problem is to make the command suite a wrapper over the standard interface. The utility /usr/local/psa/bin/domain
will be called as " plesk bin domain
". In order not to memorize the names of the plesk utility subcommands and the available utilities from the bin, add the bash completion. To make it even more convenient, add bash completion for the commands / options of the utilities themselves from bin.
# /usr/local/psa/bin/client -h Usage: client command <login_name> .. Available commands: --create or -c <login_name> Creates a new customer account..
# /usr/local/psa/bin/client --create ...
# plesk bin cl<TAB> client client_pref cloning # plesk bin client --create<TAB> --create --create-gapps-account
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa
# plesk db
# cat /etc/issue CentOS release 5.9 (Final).. # cat /usr/local/psa/version 11.5.22 CentOS 5 115130325.19 # cat /usr/local/psa/.revision 319415 # uname -a Linux hp-demo... # cat /root/.autoinstaller/microupdates.xml ...
# plesk version Product version: 11.5.30 Update #6 Update date: 2013/07/19 07:42 Build date: 2013/07/11 12:00 Build target: Debian 6.0 Revision: 323071 Architecture: 32-bit Wrapper version: 1.0
# plesk db show misc +-------------------------------------+----------------------------------------------------------------+ | param | val | +-------------------------------------+----------------------------------------------------------------+ | FullHostName | unknown | | actionlog_rot_num_periods | 30 | ...
svn log
and git log
will understand what difference there is. You can achieve this behavior, for example, using the command "| less --quit-if-one-screen --no-init".
# plesk conf panel.ini
tail
command can monitor multiple files at the same time. Using this feature, a command was created to simultaneously monitor all log files to which the panel writes:
# plesk log --all Log files: /usr/local/psa/var/log/maillog /var/log/sw-cp-server/.. ==> /usr/local/psa/var/log/maillog <== Jul 22 17:25:43 ay postfix/anvil[25376]: statistics: max connection count 1 for (smtp:1.164.98.84) at Jul 22 17:22:21 .. ==> /var/log/sw-cp-server/error_log <== ==> /usr/local/psa/admin/logs/httpsd_access_log <== ...
Usage: command [options]
" (some of Plesk’s regular utilities suffer from this). Still, some details will not hurt, namely, the listing of options, the list of subcommands, if any. For command suites, there must be a help subcommand and the ability to execute a command help subcommand. In essence, this is a substitute for a manual with the ability to filter information. And of course, true Unix-utility must have a man-page. Yes, now you can type " man plesk
" :) In general, it is thanks to man that the user can learn the subtleties of the utility and get additional information, such as usage examples, combinations of options, etc. If you set out to create your own command suite, then do not forget about usage, help subcommand and man page. Although writing a certificate is one of the habits that programmers dislike.
plesk
". Any person has the opportunity to participate in its development. Plesk is developing a very small development team. On the other hand, administrators using Plesk are several orders of magnitude larger. Since the utility is designed primarily to simplify life in the CLI for administrators, it comes with open source, and the mirror repository is on GitHub - github.com/sibprogrammer/plesk-ctl If you have some great idea and you you can implement it, that is, the chance that this functionality will be in the upstream. To minimize dependencies, the utility was written in PHP, the language used for the web interface of the panel (even though I am an ardent supporter of Ruby and JS :)). On the other hand, PHP is quite popular, so the choice of this language can only contribute to the development of the utility.
Source: https://habr.com/ru/post/187092/