Skip to content

SergiSvK/exaroton-reset

Repository files navigation

🚀 Exaroton Server Scheduler

Banner Exaroton

Python Version Docker Image Build Github Commits GitHub License Discord

Choose Your Language

Español
Español
Français
Français

The application will run and schedule the start of the Exaroton server at the specified time in the configured time zone. And it will send a notification to the specified webhook URL when the server is started.

📋 Requirements

Important

  • Python 3.10 to latest 🐍
  • An Exaroton account 🌐
  • Docker 🐳 (optional)

📑 Table of Contents

⭐ Direct Script Execution

  1. Clone the repository:

    git clone https://github.com/sergisvk/exaroton-reset.git
    cd exaroton-reset
  2. Create a .env file in the root directory of the project and add the following environment variables:

    TOKEN=
    TIMEZONE=Europe/Madrid
    WEBHOOK_URL=
    CRON_SCHEDULE_START="0 6 * * *" # Start the server at 6:00 AM
    CRON_SCHEDULE_STOP="0 22 * * *" # Stop the server at 10:00 PM
    ID_SERVER=""
    LANGUAGE=""

Note

Click here to see the explanation of each environment variable.

  1. Install the dependencies:

    pip install -r requirements.txt
  2. Run the script:

    python main.py

🐋 Docker Execution

Option 1: Docker Execution

  1. Clone the repository:

    git clone https://github.com/sergisvk/exaroton-reset.git
    cd exaroton-reset
  2. Create a .env file in the root directory of the project and add the following environment variables:

    TOKEN=
    TIMEZONE=Europe/Madrid
    WEBHOOK_URL=
    CRON_SCHEDULE_START="0 6 * * *" # Start the server at 6:00 AM
    CRON_SCHEDULE_STOP="0 22 * * *" # Stop the server at 10:00 PM
    ID_SERVER=""
    LANGUAGE="es-ES"

Note

Click here to see the explanation of each environment variable.

  1. Build the Docker image and run the container:
    docker build -t exaroton-reset .
    docker run --env-file .env exaroton-reset

Option 2: Docker Compose Execution

Tip

In my opinion, this is the best way to run the container using Docker Compose.

  1. Create a docker-compose.yml file in the root directory of the project with the following content:

    version: '3.8'
    
    services:
      exaroton-reset:
        image: ghcr.io/sergisvk/exaroton-reset:latest
        environment:
          - TOKEN=${TOKEN}
          - TIMEZONE=${TIMEZONE}
          - WEBHOOK_URL=${WEBHOOK_URL}
          - ID_SERVER=${ID_SERVER}
          - CRON_SCHEDULE_START=${CRON_SCHEDULE_START}
          - CRON_SCHEDULE_STOP=${CRON_SCHEDULE_STOP}
          - LANGUAGE=${LANGUAGE}
        restart: unless-stopped
  2. Run the following command to start the container: Another way to run the container using Docker Compose is to pass the .env file in the environment section of the docker-compose.yml file.

    version: '3.8'
    
    services:
      exaroton-reset:
        image: ghcr.io/sergisvk/exaroton-reset:latest
        env_file:
          - .env
        restart: unless-stopped

This will start the container using the latest image published in the GitHub Container Registry and the environment variables defined in the .env file.

🌱 Explanation of Environment Variables

  • TOKEN: This is the Exaroton API token used to authenticate requests to the Exaroton API. You must get this token from your Exaroton account.

  • TIMEZONE: The time zone in which you want to schedule the server start. It must be in a recognized tz format (e.g., Europe/Madrid).

  • WEBHOOK_URL: The webhook URL where notifications will be sent. This can be a Discord webhook URL or another service that accepts webhooks.

  • CRON_SCHEDULE_START: The cron schedule for starting the server. In this case, it is set to start the server every day at 6:00 AM ("0 6 * * *").

  • CRON_SCHEDULE_STOP: The cron schedule for stopping the server. In this case, it is set to stop the server every day at 10:00 PM ("0 22 * * *").

  • ID_SERVER: The ID of your Exaroton server. This ID is unique for each server and is used to identify the server you want to start.

  • LANGUAGE: The language in which the notifications will be sent. The available languages are en-UK, es-ES,fr-FR, pt-PT

Explanation of CRON functionality

The cron format is used to schedule tasks at specific intervals. The syntax of a cron expression is as follows:

* * * * *
| | | | |
| | | |  ---- Day of the week (0 - 7) (Sunday to Saturday, where 0 and 7 are Sunday)
| | |  ------ Month (1 - 12)
| |  -------- Day of the month (1 - 31)
|  ---------- Hour (0 - 23)
 ------------ Minute (0 - 59)

Each field can contain one or more values, separated by commas. Values can be specific numbers, ranges of numbers, or special characters such as * (any value), / (increments), and - (ranges).

🤝 Contributions

Contributions are welcome. Please open an issue or a pull request to discuss any changes you would like to make.

GitHub Contributors GitHub Issues

🪙 Donate

This project is maintained by SergiSvK. If you find this project helpful, please consider making a donation.

📄 License

This project is licensed under the MIT Licence. See the LICENSE file for more information.