Last active
January 16, 2024 15:18
-
-
Save sistematico/9ea8af3bb16e8fcdb127e3acbc4ec08d to your computer and use it in GitHub Desktop.
FiveM Server Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=FiveM Server | |
[Service] | |
Type=oneshot | |
User=ubuntu | |
WorkingDirectory=/opt/fivem | |
ExecStart=/opt/fivem/fivem.sh | |
ExecStop=/usr/bin/tmux kill-session -t fivem | |
RemainAfterExit=yes | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
FIVEM_SESSION="fivem" | |
FIVEM_PATH="/opt/fivem" | |
FIVEM_DATA="$FIVEM_PATH/FXServer/server-data" | |
if ! tmux has-session -t $FIVEM_SESSION 2>/dev/null; then | |
\tmux new-session -s $FIVEM_SESSION -n fivem -d | |
\tmux send-keys -t $FIVEM_SESSION:fivem "cd ${FIVEM_DATA} ; clear" ENTER | |
\tmux new-window -a -t $FIVEM_SESSION -n server -d | |
\tmux send-keys -t $FIVEM_SESSION:server "clear ; cd ${FIVEM_DATA} ; /usr/bin/bash $FIVEM_PATH/FXServer/server/run.sh +exec server.cfg" ENTER | |
\tmux detach -s $FIVEM_SESSION | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment