Skip to content

Instantly share code, notes, and snippets.

@SCP002
Created July 18, 2023 02:08
Show Gist options
  • Save SCP002/3d6f3e65655ee3b96e9663e20ed5cbc3 to your computer and use it in GitHub Desktop.
Save SCP002/3d6f3e65655ee3b96e9663e20ed5cbc3 to your computer and use it in GitHub Desktop.
Example of running two Cesbo Astra instances on two different ports as systemctl services.
# write systemd config for the first instance
sudo tee /lib/systemd/system/astra-8000.service > /dev/null << ENDSEQ
[Unit]
Description=Astra 8000 service (%N)
After=network-online.target
StartLimitBurst=5
StartLimitIntervalSec=10
[Service]
Type=simple
TimeoutStartSec=10
LimitNOFILE=65536
ExecStartPre=/bin/mkdir -p /etc/astra
ExecStart=/usr/bin/astra -c /etc/astra/astra-8000-config.json -p 8000 --log /var/log/astra-8000.log --no-stdout
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=1
[Install]
WantedBy=multi-user.target
ENDSEQ
# write systemd config for the second instance
sudo tee /lib/systemd/system/astra-9000.service > /dev/null << ENDSEQ
[Unit]
Description=Astra 9000 service (%N)
After=network-online.target
StartLimitBurst=5
StartLimitIntervalSec=10
[Service]
Type=simple
TimeoutStartSec=10
LimitNOFILE=65536
ExecStartPre=/bin/mkdir -p /etc/astra
ExecStart=/usr/bin/astra -c /etc/astra/astra-9000-config.json -p 9000 --log /var/log/astra-9000.log --no-stdout
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=1
[Install]
WantedBy=multi-user.target
ENDSEQ
# make first instance start automatically
sudo systemctl enable astra-8000
# make second instance start automatically
sudo systemctl enable astra-9000
# start first instance now
sudo systemctl start astra-8000
# start second instance now
sudo systemctl start astra-9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment