Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Pterodactyl bash script to auto start servers (at boot for example)

Notifications You must be signed in to change notification settings

ign-gg/pterodactylAutoStart

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️Pterodactly just introduced the feature "return to the latest powerstate of a server" so this script is basically useless now.⚠️

Please use the new feature in pterodactyl: pterodactyl/panel#136 (comment)

Pterodactyl Auto Start

Build Status

Description

This bash script auto start (at boot for example) the servers in Pterodactyl that have alwaysStart in their description.

Requirements

  • You need to set two environment variables:
    • 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

Installation

  1. Generate an account API token: https://your.pterodactyl.panel/account/api
  2. Download the git repository to the /opt/pterodactylAutoStart directory using:
sudo git clone https://github.com/Alteiria/pterodactylAutoStart.git /opt/pterodactylAutoStart
  1. 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
  1. Move the service file from the installation directory to the systemd service files:
sudo mv /opt/pterodactylAutoStart/pterodactylAutoStart.service /etc/systemd/system/pterodactylAutoStart.service
  1. Edit the service file and modify the two environment variables baseURL and apiToken:
sudo nano /etc/systemd/system/pterodactylAutoStart.service

Note: Make sure to follow the Requirements section for the two environment variables!

  1. Enable the service file to make the script starting at boot:
sudo systemctl enable pterodactylAutoStart
  1. 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 second s!

    Screenshot of one of my server that auto start:

How to test if the script works as intended.

  1. Manually shutdown a server that you configured to auto start.
  2. Run the systemd start command to start the script:
sudo systemctl start pterodactylAutoStart
  1. Check if your server start after that, it will take up to 80 seconds because there is an hard coded delay in the service file (more details available here).
  2. If your server didn't start after that period of 80 seconds check the logs using journalctl:
sudo journalctl -u pterodactylAutoStart

If you see some text or errors please open a new issue.

About

Pterodactyl bash script to auto start servers (at boot for example)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%