Auto update
Shell Script that pulls the latest Linux artifact and replaces it with the current one you have installed.
Section titled “Shell Script that pulls the latest Linux artifact and replaces it with the current one you have installed.”#!/bin/bash
# Set the API URLAPI_URL="https://changelogs-live.fivem.net/api/changelog/versions/linux/server"
latestVersion=$(curl -s "$API_URL" | jq -r '.latest')
latestDownloadUrl=$(curl -s "$API_URL" | jq -r '.latest_download')
statusCode=$(curl --write-out %{http_code} --silent --output /dev/null $latestDownloadUrl)
if [[ "$statusCode" -eq 200 ]]; then echo "Successfully executed request to the artifacts API"
echo "Removing old alpine fx.tar.xz" rm -rf alpine/ fx.tar.xz echo "Latest FXServer build: $latestVersion" echo "Installing the last build:" wget --no-verbose $latestDownloadUrl tar xf fx.tar.xz
else echo "There was a problem reaching the artifacts API"fiUsage:
Section titled “Usage:”- Create a shell script in your
serverdirectory usingtouch auto-update.sh - Type
nano auto-update.sh, now paste in the shell script code. - Perform the command
chmod +x auto-update.sh - Run the file
./auto-update.sh - Now you can run the server again with
./run.sh.