• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Plesk CLI questions

VITEX

New Pleskian
Hi,

I am about to finalize my server auto-install script (fully automatic) - all tweaks are already included - I am just struggling on 3 things and hope to get some help.

1.) Server IP (which is randomly assigned by the cloud provider) is set to dedicated by default - how can I change this to shared via command line after plesk init_conf has already been run ?

2.) I´d like to enable "Automatically install system package updates" via CLI command - I did find appropriate settings in the database/documentation for Plesk Updates but not for OS/3rd Party. How can I archive this ?

3.) I´ve got a partner central account - if I do purchase the appropriate license before activating the install script, can I pull down the license/register the server without using the plesk bin license --install activation_code_number command ?

BR,
VITEX
 
I did the same and here's what I do:

1) You can pass the parameter "-ip-type shared" directly to "plesk init_conf" when you run it, example:
Code:
plesk bin init_conf --init -default-ip <ipaddr> -netmask <netmask> -iface <interface> -ip-type shared -hostname <hostname> [...all other parameters go here...]

To change the server IP type after you've already run init_conf then I think you can do that with:
Code:
plesk bin ipmanage --update <ipaddress> -type shared

See also: ipmanage: IP Addresses

2) No warranties, but try this in your script:
Code:
plesk db "UPDATE misc SET val='true' WHERE param='automaticSystemPackageUpdates';"

3) Not that I'm aware. You could pass the license activation code as an argument to your install script and then use it with plesk bin license in your script.

But maybe somebody has a better idea?
 
3) maybe have a script run on first boot that curls the plesk api to issue the license and then apply it. You'll want to have the script remove itself after it's ran.
 
Thanks guys for your awesome help - this took me into the right direction!
1 + 3 is solved - since I don´t know the IP upfront my host is to, I ended up with this solution:

Code:
serverip=`hostname  -I | cut -f1 -d' '`
hostname=`hostname`
read -p "Plesk License-Key:" key
read -p "Plesk Password:" pass

plesk bin init_conf --init -hostname $hostname -default-ip $serverip -ip-type shared -passwd $pass -send_announce false -trial_license true -license_agreed true

plesk bin license --install $key

This will now also ask for the license key (which can vary since it may sometimes be WebAdmin Edition, sometimes Web Pro, sometimes VPS, sometimes Dedicated). Hence I do purchase the appropriate license (which may also include Add-Ons such as KernelCare) in the Partner Central account and enter the key before the installation starts. This works now all pretty well!

The only open item is the system update issue - I already tried
Code:
plesk db "UPDATE misc SET val='true' WHERE param='automaticSystemPackageUpdates';"
before, but it seems to not have any effect (at least the option is not set active in the panel) - any other ideas ?

Again - thanks!

BR
VITEX
 
The only open item is the system update issue - I already tried
Code:
plesk db "UPDATE misc SET val='true' WHERE param='automaticSystemPackageUpdates';"
before, but it seems to not have any effect (at least the option is not set active in the panel) - any other ideas ?

I just noticed that this parameter does not exist anymore in the psa.misc table. It used to exist in older versions of Plesk but on 17.5 and 17.8 it's gone.
So I can't tell you how to enable that via CLI right now.
But the System Update Tool should be enabled by default, as described here: System Updates (Plesk for Linux only)

Did you check your panel.ini if you maybe disabled the tool?
(I have it disabled deliberately on all our servers, so I can't tell you if it's really enabled by default)
 
Hm - sounds like I need to dig a bit deeper. I have just confirmed with a out of the box Plesk install, that the option
"Automatically install system package updates Note that this will also automatically install updates for third-party components shipped by Plesk" is not enabled by default.

If someone else has suggestion, feel free to help ;-)

BR
VITEX
 
Update:

If the option has been ticked once in the panel, changes in the database via

plesk db "UPDATE misc SET val='true' WHERE param='automaticSystemPackageUpdates';"
plesk db "UPDATE misc SET val='false' WHERE param='automaticSystemPackageUpdates';"

are working - however not, if the option has not been touched in first place. Is there probably another entry created in the database if the option is enabled in the panel for the first time ?

BR
VITEX
 
Ah in that case the entry in the DB will only be created when you change the settings for the first time in the GUI.

So you'll need to INSERT the value into the DB instead of updating them in your script, like this:

Code:
plesk db "INSERT INTO misc (param, val) VALUE ('automaticSystemPackageUpdates', '1')"
 
Cool - it works!

The following 2 lines need to be added to the script, it´s then marked active:

plesk db "INSERT INTO misc (param, val) VALUE ('automaticSystemPackageUpdates', '1')"
plesk db "UPDATE misc SET val='true' WHERE param='automaticSystemPackageUpdates';"

Thank you very much!
 
One last comment: Maybe you can simplify your script by using "true" instead of "1" right from the beginning:
Code:
plesk db "INSERT INTO misc (param, val) VALUE ('automaticSystemPackageUpdates', 'true')"

Anyway, glad it works now!
 
Back
Top