{"id":29222423,"url":"https://github.com/alexitx/ets2-server-watchdog","last_synced_at":"2025-07-03T03:32:55.817Z","repository":{"id":302450528,"uuid":"1009699985","full_name":"alexitx/ets2-server-watchdog","owner":"alexitx","description":"Monitoring script for Euro Truck Simulator 2 dedicated server","archived":false,"fork":false,"pushed_at":"2025-07-02T12:09:43.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-02T13:25:34.753Z","etag":null,"topics":["ets2","euro-truck-simulator-2","monitoring","watchdog"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexitx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-27T15:03:50.000Z","updated_at":"2025-07-02T12:09:46.000Z","dependencies_parsed_at":"2025-07-02T13:25:40.924Z","dependency_job_id":"6b3b5a30-484f-483e-a07b-a01cd40d9701","html_url":"https://github.com/alexitx/ets2-server-watchdog","commit_stats":null,"previous_names":["alexitx/ets2-server-watchdog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexitx/ets2-server-watchdog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexitx%2Fets2-server-watchdog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexitx%2Fets2-server-watchdog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexitx%2Fets2-server-watchdog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexitx%2Fets2-server-watchdog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexitx","download_url":"https://codeload.github.com/alexitx/ets2-server-watchdog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexitx%2Fets2-server-watchdog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263253390,"owners_count":23437850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ets2","euro-truck-simulator-2","monitoring","watchdog"],"created_at":"2025-07-03T03:31:06.787Z","updated_at":"2025-07-03T03:32:55.804Z","avatar_url":"https://github.com/alexitx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ETS2 Server Watchdog\n\nMonitoring script for a [Euro Truck Simulator 2 dedicated server][ets2-dedicated-server] that detects and stops the\nserver in rare cases where it hangs during startup or loses connection to Steam, allowing it to be restarted\nautomatically. Currently supports Linux only.\n\n\n## Table of contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Watchdog script](#watchdog-script)\n    - [ETS2 server](#ets2-server)\n    - [CLI arguments](#cli-arguments)\n- [License](#license)\n\n\n## Installation\n\nRequirements:\n- Python 3.9+\n- Any modern Linux distribution\n\n1. Clone or download the repository\n\n    ```sh\n    git clone https://github.com/alexitx/ets2-server-watchdog\n    cd ets2-server-watchdog\n    ```\n\n2. Create a virtual environment using [virtualenv][virtualenv] or [venv][venv]\n\n    ```sh\n    python3 -m virtualenv venv\n    source ./venv/bin/activate\n    ```\n\n3. Install dependencies\n\n    ```sh\n    pip install -r requirements.txt\n    ```\n\n\n## Usage\n\nRun the server and watchdog script in separate terminals, screen/tmux sessions, or however is most convenient. The\nwatchdog must be run as the same user as the server, or as root, to allow it to find the process of the server.\n\nIf the server is running inside Docker or any other sandboxed environment, you can pass custom command to the watchdog\nscript using `--command` to be run whenever the server should be restarted. Make sure the server log file is accessible\non disk and that the watchdog has appropriate permissions to read it.\n\nSee [example scripts][examples].\n\n### Watchdog script\n\n```sh\npython3 ets2_server_watchdog.py --server-log \u003cserver log file\u003e\n```\n\nThe server log file is in the `Euro Truck Simulator 2` home directory, which is automatically created on server start in\n`$HOME` or `$XDG_DATA_HOME`.\n\n### ETS2 server\n\n1.  Create a start script for the ETS2 server that ensures the correct working directory for the server, has all\n    environment variables set, such as `$LD_LIBRARY_PATH` or `$XDG_DATA_HOME` (to set the location of the `Euro Truck\n    Simulator 2` config directory), and runs the server executable.\n\n    Example:\n    ```sh\n    #!/bin/bash\n\n    SERVER_DIR=\"$HOME/servers/ets2-server\"\n    cd \"$SERVER_DIR\"\n\n    export LD_LIBRARY_PATH=\"$SERVER_DIR/linux64\"\n    export XDG_DATA_HOME=\"$SERVER_DIR\"\n\n    ./bin/linux_x64/eurotrucks2_server\n    ```\n\n2.  Wrap the executable call in a loop instead and add a small timeout after the server stops but before it restarts to\n    allow exiting the script with Ctrl-C.\n\n    Before:\n    ```sh\n    ./bin/linux_x64/eurotrucks2_server\n    ```\n\n    After:\n    ```sh\n    while true; do\n        ./bin/linux_x64/eurotrucks2_server\n        echo 'Restarting the server in 3 seconds, press Ctrl-C to abort'\n        sleep 3\n    done\n    ```\n\n### CLI arguments\n\n| Argument              | Default | Required | Description                                                                                         |\n|-----------------------|---------|----------|-----------------------------------------------------------------------------------------------------|\n| `--debug`             |         | No       | Log debug messages                                                                                  |\n| `--debug-tail`        |         | No       | If debug is enabled, also log tail command output                                                   |\n| `--server-log`        |         | Yes      | Server log file                                                                                     |\n| `--hang-timeout`      | `1.0`   | No       | Time in seconds for the server to hang on initialization before being killed                        |\n| `--reconnect-timeout` | `300.0` | No       | Time in seconds for the server to reconnect to Steam before being stopped                           |\n| `--stop-timeout`      | `5.0`   | No       | Time in seconds for the server to stop gracefully before being killed                               |\n| `--monitor-interval`  | `0.25`  | No       | Interval in seconds for monitoring log line changes; Should be \u003c other timeout values, usually \u003c 1s |\n| `--command`           |         | No       | Custom command to run instead of finding and stopping the server process                            |\n\n\n## License\n\nMIT license. See [LICENSE][license] for more information.\n\n\n[ets2-dedicated-server]: https://modding.scssoft.com/wiki/Documentation/Tools/Dedicated_Server\n[virtualenv]: https://virtualenv.pypa.io/en/latest/\n[venv]: https://docs.python.org/3/library/venv.html\n[examples]: https://github.com/alexitx/ets2-server-watchdog/tree/master/examples\n[license]: https://github.com/alexitx/ets2-server-watchdog/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexitx%2Fets2-server-watchdog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexitx%2Fets2-server-watchdog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexitx%2Fets2-server-watchdog/lists"}