Skip to content

Instantly share code, notes, and snippets.

@cetteup
Created March 2, 2023 18:45
Show Gist options
  • Save cetteup/12ed4b5b4eda56c65421302c7ebfc262 to your computer and use it in GitHub Desktop.
Save cetteup/12ed4b5b4eda56c65421302c7ebfc262 to your computer and use it in GitHub Desktop.
Run a Battlefield 2 server as a systemd service
[Unit]
Description=Battlefield 2 dedicated server with BF2CC
After=network-online.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
# You need to to configure <GameExecArgs>+noStatusMonitor 1</GameExecArgs> in BF2CC's config.xml, default is <GameExecArgs />
WorkingDirectory=path_to_bf2_folder
ExecStart=/usr/bin/mono paht_to_bf2ccd.exe -autostart -showlog
Restart=always
RestartSec=15s
TimeoutStopSec=5s
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n
User=some_non_privileged_user
[Unit]
Description=Battlefield 2 dedicated server
After=network-online.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
WorkingDirectory=path_to_bf2_folder
ExecStart=path_to_bf2_start.sh +noStatusMonitor 1
Restart=always
RestartSec=15s
TimeoutStopSec=5s
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n
User=some_non_privileged_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment