Update Server Startup with Application API

Update startup of the given server.

Usage

<?php
    $pterodactyl->updateServerStartup($serverId, array $data);

    //For a server instance
    $server->updateStartup(array $data);
?>

Parameters

Note

The serverId is the id of the server, not identifier, externalId or uuid.

Parameter Description Rules
serverId The id of the server
data The data you want to update

data

Parameter Description Rules
startup Startup command required|string
environment Environment variables present|array
egg Egg id required|exists:eggs,id
pack Pack id sometimes|nullable|numeric|min:0
image Docker image required|string|max:255
skip_scripts Skip egg scripts or not present|boolean

Returns

Returns a server instance.

{
    "id": 14,
    "externalId": null,
    "uuid": "76c59598-22df-4490-92bc-f6fb4a80e0c7",
    "identifier": "76c59598",
    "node": 1,
    "name": "server1",
    "description": "",
    "suspended": false,
    "pack": null,
    "createdAt": "2019-01-23T04:38:09+00:00",
    "updatedAt": "2019-08-05T09:36:13+00:00",
    "limits": {
        "memory": 128,
        "swap": 0,
        "disk": 256,
        "io": 500,
        "cpu": 0
    },
    "allocations": [{
        "id": 55,
        "nodeId": null,
        "ip": "123.123.123.123",
        "ipAlias": null,
        "port": 50053,
        "serverId": null,
        "createdAt": null,
        "updatedAt": null,
        "object": "allocation",
        "alias": "node-1.pterodactyl.panel",
        "assigned": true
    }],
    "object": "server",
    "featureLimits": {
        "databases": 0,
        "allocations": 0
    },
    "user": 1,
    "allocation": 55,
    "nest": 8,
    "egg": 20,
    "container": {
        "startup_command": ".\/Jcmp-Server",
        "image": "hcgcloud\/pterodactyl-jc2mp:latest",
        "installed": true,
        "environment": {
            "SERVER_AUTOUPDATE": "0",
            "STARTUP": ".\/Jcmp-Server",
            "P_SERVER_LOCATION": "test",
            "P_SERVER_UUID": "76c59598-22df-4490-92bc-f6fb4a80e0c7"
        }
    },
    "relationships": {
        "allocations": {
            "object": "list",
            "data": [{
                "object": "allocation",
                "attributes": {
                    "id": 55,
                    "ip": "123.123.123.123",
                    "alias": "node-1.pterodactyl.panel",
                    "port": 50053,
                    "assigned": true
                }
            }]
        }
    }
}

Example

<?php
    try {
        $pterodactyl->updateServerStartup(14, [
            'startup' => './Jcmp-Server',
            'environment' => [
                'SERVER_AUTOUPDATE'
            ],
            'egg' => 20,
            'pack' => null,
            'image' => 'hcgcloud/pterodactyl-jc2mp:latest',
            'skip_scripts' => false
        ]);
    } catch(\Exception $e){
        print_r($e->getMessage());
    }
?>
<?php
    try {
        $server = $pterodactyl->server(14);
        $server->updateStartup([
            'startup' => './Jcmp-Server',
            'environment' => [
                'SERVER_AUTOUPDATE'
            ],
            'egg' => 20,
            'pack' => null,
            'image' => 'hcgcloud/pterodactyl-jc2mp:latest',
            'skip_scripts' => false
        ]);
    } catch(\Exception $e){
        print_r($e->getMessage());
    }
?>