Server services, such as mail service, DNS service, FTP and so on, can be started, stopped and restarted via both Plesk GUI and Plesk API RPC protocol. To start, stop or restart a particular service, use the srv_man operation.
To get information on the current state of the server services (whether each is started or stopped at the moment), use the get operation with services_state parameter specified.
A request XML packet starting, stopping or restarting server services contains the srv_man operation node:
<packet>
<server>
<srv_man>
...
</srv_man>
</server>
</packet>
The srv_man node is presented by complex type ServicesManagementType (server_input.xsd
) and structured as follows:
plesk_server.xsd
).plesk_server.xsd
). Allowed values: start | stop | restart.
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
The srv_man node of the response packet is structured as follows:
server_output.xsd
).plesk_server.xsd
).This packet stops the web and Fail2Ban services on Linux-based servers.
<packet>
<server>
<srv_man>
<id>web</id>
<operation>stop</operation>
</srv_man>
<srv_man>
<id>fail2ban</id>
<operation>stop</operation>
</srv_man>
</server>
</packet>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<server>
<srv_man>
<result>
<status>ok</status>
<id>web</id>
</result>
</srv_man>
<srv_man>
<result>
<status>ok</status>
<id>fail2ban</id>
</result>
</srv_man>
</server>
</packet>
This packet starts PostgreSQL and MySQL database services.
<packet>
<server>
<srv_man>
<id>postgresql</id>
<operation>start</operation>
</srv_man>
<srv_man>
<id>mysql</id>
<operation>start</operation>
</srv_man>
</server>
</packet>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<server>
<srv_man>
<result>
<status>ok</status>
<id>postgresql</id>
</result>
</srv_man>
<srv_man>
<result>
<status>error</status>
<errcode>1013</errcode>
<errtext>Service 'mysql' does not exist</errtext>
</result>
</srv_man>
</server>
</packet>