Any way to set any of the following via command line?

HostaHost

Silver Pleskian
We really need to automate the setup of new servers; is it possible to set any of the following by command line?

  • Adding Event Manager events.
  • On the "Server settings" area, changing the retain webstats number, turn off including logs in disk usage, setting traffic to outbound only.
  • Adding and removing records from the default DNS template.
  • On the "Mail settings" area, setting the max message size, enabling the submission port, switching on SPF and choosing the option, setting the DNSRBL on and adding servers.
  • Changing the default spam filter threshold.
  • Adding/removing notification selections and enabling and adding a custom email address.
  • Changing the retention time on the Action Log screen.
  • Enabling "Do not show newsfeeds in webmail and on default domain pages" on the Interface Management screen.
 
Got it. Only ran into a few minor issues:

1) I can't find a way to change the action log retention time via command line.
2) For event handlers, the location of the correct command is /usr/local/psa/bin/event_handler
3) For the /usr/local/psa/bin/server_pref utility, the argument to update settings is --update rather than -update, or you can use -u. These options are not yet in the manual but are available:
Code:
    -autoupdates       <true|false>    Automatically download and install
                                       updates for the currently installed
                                       version
    -release-tier      <tier>          Notify me when the upgrade to the
                                       following Panel version is available
    -autoupgrade-stable  <true|false>  Upgrade to a new stable version of
                                       Panel when it becomes available
4) The mail server settings have to be run one at a time, for example, you can't run:

/usr/local/psa/bin/mailserver --set-max-letter-size 35M --set-maps-status true --set-maps-zone bl.spamcop.net,zen.spamhaus.org --use-vocabulary true --update-spf --set-message-submission true -spf-status true -spf-behavior 3

You have to run the mail server commands one at a time and in a specific order or they'll fail:
Code:
/usr/local/psa/bin/mailserver --set-max-letter-size 35M
/usr/local/psa/bin/mailserver --set-maps-zone bl.spamcop.net,zen.spamhaus.org
/usr/local/psa/bin/mailserver --set-maps-status true 
/usr/local/psa/bin/mailserver --use-vocabulary true
/usr/local/psa/bin/mailserver --set-message-submission true
/usr/local/psa/bin/mailserver --update-spf -spf-status true
/usr/local/psa/bin/mailserver --update-spf -spf-behavior 3
 
Can the server admin IP address restrictions be set via command line and/or the database? No mention of that in the manual.
 
mysql> desc cp_access;
+---------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+----------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| type | enum('allow','deny') | NO | | allow | |
| netaddr | varchar(39) | NO | | NULL | |
| netmask | varchar(15) | NO | | NULL | |
+---------+----------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
 
mysql> desc cp_access;
+---------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+----------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| type | enum('allow','deny') | NO | | allow | |
| netaddr | varchar(39) | NO | | NULL | |
| netmask | varchar(15) | NO | | NULL | |
+---------+----------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

Actually it requires a change in the misc table too; but no command line interface for just setting them like "./ip_restrict 1.2.3.4/21 allow" or similar?
 
Back
Top