CLI Commands

A list of CLI commands with descriptions to streamline panel management and configuration.

The Commands section serves as a detailed reference for administrators and advanced users to efficiently manage and configure the PteroCA panel through the command-line interface (CLI). Each command is designed to perform a specific action, such as managing configurations, resetting settings, or troubleshooting issues.


Configuration Commands

Database Configuration

The app:configure-database command is executed during the initial installation of the panel. It sets up the database connection and configures the necessary settings to enable the panel's functionality.

Example Usage:

php bin/console app:configure-database

This command is a crucial part of the setup process and should be completed before any further configuration.


System Configuration

The app:configure-system command is used during the initial setup of the panel. It configures key system settings required for the panel to operate seamlessly, such as paths, environment variables, and other foundational options.

Example Usage:

php bin/console app:configure-system

This command is an essential step in preparing the panel environment and must be run as part of the initial configuration process.


User Management Commands

Create New User

The app:create-new-user command is used to create a new user in the system by specifying an email, password, and an optional role. While this command is automatically executed during the app:configure-system process to create the initial administrator account, it can also be run separately to create additional users at any time.

Command Details
  • Command: app:create-new-user

  • Description: Creates a new user in the system (and Pterodactyl if connected) with specified credentials and role.

  • Arguments:

    • email (required): The email address of the user.

    • password (required): The password for the user.

    • role (optional): The role assigned to the user. Defaults to ROLE_USER. Available roles are defined in UserRoleEnum (e.g., ROLE_USER, ROLE_ADMIN).

Example Usage: To create a user with the default ROLE_USER:

php bin/console app:create-new-user user@example.com securePassword

To create an admin user:

php bin/console app:create-new-user admin@example.com securePassword ROLE_ADMIN

Process Overview:

  • During app:configure-system, this command is automatically triggered to create the first user (typically an administrator).

  • When run separately, it allows administrators to create additional users as needed.

  • The command validates the role provided. If an invalid role is passed, it defaults to ROLE_USER.

  • If connected to the Pterodactyl API, a user with the same credentials is also created in Pterodactyl.


Change User Password

The app:change-user-password command is used to update the password of an existing user in the system. Like other commands, it integrates with Pterodactyl if an API connection is established, ensuring that the user's password is updated on both the panel and Pterodactyl simultaneously.

Command Details
  • Name: app:change-user-password

  • Description: Changes the password for an existing user in the panel (and Pterodactyl, if connected).

  • Arguments:

    • email (required): The email address of the user whose password is being updated.

    • password (required): The new password to set for the user.


System Commands

Cron Job Schedule

The app:cron-job-schedule command is a critical system command designed to execute other scheduled commands at defined intervals. It serves as a facade, running specific system maintenance commands that ensure the smooth operation of the panel. This command is intended to be added to a crontab (or a crontab alternative) to automate recurring tasks.

Command Details
  • Name: app:cron-job-schedule

  • Description: Executes scheduled system commands, such as suspending unpaid servers and deleting inactive servers, to maintain system health and functionality.

Current Scheduled Commands

The app:cron-job-schedule command currently executes the following commands:

  • app:suspend-unpaid-servers: Suspends servers for users with unpaid balances.

  • app:delete-inactive-servers: Deletes servers that have been inactive for a predefined period.

Example usage:

php bin/console app:cron-job-schedule

Automating with Crontab

To ensure this command runs automatically, add it to your crontab (or an alternative scheduling system). For example, to run this command every hour, use the following crontab configuration:

* * * * * php /var/www/pteroca/bin/console app:cron-job-schedule >> /dev/null 2>&1

Refer to the Crontab Configuration section for more details.


Delete Inactive Servers

The app:delete-inactive-servers command is a maintenance utility responsible for removing servers that have been suspended due to non-payment or inactivity for a prolonged period. This ensures that resources are not wasted on servers that are no longer in use.

When executed, this command permanently deletes suspended servers both from the PteroCA panel and the linked Pterodactyl instance (if the API connection to Pterodactyl is configured). It is typically part of the scheduled tasks executed by the app:cron-job-schedule command but can also be run independently when necessary.

Command Details
  • Name: app:delete-inactive-servers

  • Description: Deletes suspended servers that have remained inactive for an extended duration, ensuring efficient resource utilization.

Example usage:

php bin/console app:delete-inactive-servers

Show Missing Translations

The app:show-missing-translations command is a developer-oriented tool designed to compare two YAML translation files and identify any missing keys in the target file. It is particularly useful in ensuring consistency between translation files during development.

Command Details
  • Name: app:show-missing-translations

  • Description: Compares a main translation file with another file and identifies any missing translation keys in the compared file.

Example usage:

php bin/console app:show-missing-translations src/Core/Resources/translations/messages.en.yaml src/Core/Resources/translations/messages.pl.yaml

Suspend Unpaid Servers

The app:suspend-unpaid-servers command is a critical maintenance utility that automatically suspends servers whose payment obligations have not been met. This ensures proper billing compliance and prevents unpaid servers from utilizing resources.

When a server is suspended, it is flagged as inactive in the PteroCA panel and also suspended in the connected Pterodactyl instance (if the API connection is configured). Suspended servers can be reactivated if the client completes the payment. However, servers that remain suspended for an extended period may eventually be deleted by the app:delete-inactive-servers command.

Command Details
  • Name: app:suspend-unpaid-servers

  • Description: Automatically suspends servers that are overdue for payment, marking them as inactive both in the PteroCA panel and in Pterodactyl.

Example usage:

php bin/console app:suspend-unpaid-servers

Synchronize Data

The app:synchronize-data command is a utility designed to ensure data consistency between the PteroCA panel and the connected Pterodactyl instance. It is primarily used to synchronize critical data, such as API keys, ensuring seamless integration and communication between the two systems.

At present, this command specifically handles the synchronization of Pterodactyl API keys for users in the PteroCA panel. However, its scope can be extended in the future to include additional synchronization processes as required.

Command Details
  • Name: app:synchronize-data

  • Description: Synchronizes data between the PteroCA panel and Pterodactyl, currently focusing on user API keys. Future updates may expand its responsibilities.

Example usage:

php bin/console app:synchronize-data

Last updated