This bash script auto start (at boot for example) the servers in Pterodactyl that have alwaysStart
in their description.
Modified by NoxShadow YT to migrate to Replit, All credit goes to https://github.com/Alteiria/ for her amazing pterodactylAutoStart.
- You need to set two Secrets in your Replit.:
baseURL
: The URL of your Pterodactyl panel +/api
. Example:https://your.pterodactyl.panel/api
apiToken
: The token generated from the Account API page.
- And having jq >1.6 installed: https://github.com/stedolan/jq/releases
- Generate an account API token: https://your.pterodactyl.panel/account/api
- Download the git repository to the
/opt/pterodactylAutoStart
directory using:
sudo git clone https://github.com/Alteiria/pterodactylAutoStart.git /opt/pterodactylAutoStart
- Install JQ from the release page:
sudo wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O /usr/bin/jq
sudo chmod +x /usr/bin/jq
- Move the service file from the installation directory to the systemd service files:
sudo mv /opt/pterodactylAutoStart/pterodactylAutoStart.service /etc/systemd/system/pterodactylAutoStart.service
- Edit the service file and modify the two environment variables
baseURL
andapiToken
:
sudo nano /etc/systemd/system/pterodactylAutoStart.service
Note: Make sure to follow the Requirements section for the two environment variables!
- Enable the service file to make the script starting at boot:
sudo systemctl enable pterodactylAutoStart
-
On your Pterodactyl panel, edit the description of every server that you wish to auto start by simply adding
alwaysStart
in their description. Watchout for the capitalized in the seconds
!
- Manually shutdown a server that you configured to auto start.
- Run the systemd start command to start the script:
~~sudo systemctl start pterodactylAutoStart~~ Click the run button on Replit.
- Check if your server start after that, it will take up to 80 seconds because there is a delay of 60 seconds to abid with Replit's TOS to controll data traffic. (more details available here).
- If your server didn't start after that period of 80 seconds check the logs using journalctl:
journalctl -u pterodactylAutoStart
By the way run journalctl in Replit Shell at least once so it will prompt you to install journalctl to replit.nix.