1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00
Files
nttgin-BGPalerter/docs/linux-service.md

60 lines
1.7 KiB
Markdown
Raw Normal View History

2020-04-29 22:35:27 +02:00
## Run BGPalerter as a Linux Service
If you are interested in running this application as a service on a Linux server here is a basic guide covering how to do that. This process works for RHEL 7 based Linux installations. It will likely work very similiarly on other systemctl enabled installations.
### Create directory for the application to reside
2020-05-18 18:05:52 +02:00
Create a user for BGPalerter
2020-05-18 18:05:52 +02:00
```bash
adduser bgpalerter
sudo su bgpalerter
```
2020-05-18 18:05:52 +02:00
If this is a new installation, download the BGPalerter binary in the home of the newly created user and execute it:
2020-04-30 00:34:40 +02:00
```
2020-05-18 18:05:52 +02:00
cd /home/bgpalerter
2020-04-30 00:34:40 +02:00
wget https://github.com/nttgin/BGPalerter/releases/latest/download/bgpalerter-linux-x64
chmod +x bgpalerter-linux-x64
./bgpalerter-linux-x64
```
2020-05-18 18:05:52 +02:00
The auto-configuration will start at the end of which all the needed files will be created.
2020-04-30 00:34:40 +02:00
2020-05-18 18:05:52 +02:00
If this is an existing install simply move the files of your existing install into this directory `mv -t /home/bgpalerter bgpalerter-linux-x64 bgpalerter.pid config.yml prefixes.yml`
2020-04-30 00:34:40 +02:00
2020-05-18 18:05:52 +02:00
The application will also create `logs` and `src` subdirectories here if needed.
### Create systemd service file
Next you need to create the systemd service file.
2020-05-18 18:05:52 +02:00
`sudo vi /etc/systemd/system/bgpalerter.service`
The contents of this file should be as follows:
```
[Unit]
2020-04-29 22:35:27 +02:00
Description=BGPalerter
After=network.target
[Service]
Type=simple
2020-05-18 18:05:52 +02:00
Restart=on-failure
User=bgpalerter
WorkingDirectory=/home/bgpalerter
ExecStart=/home/bgpalerter/bgpalerter-linux-x64
[Install]
WantedBy=multi-user.target
```
### Reload systemd
Reload systemd to register the new configuration.
`systemctl daemon-reload`
### Enable and start the service
2020-04-29 22:35:27 +02:00
Enable BGPalerter to start at boot and then start the service.
`systemctl enable bgpalerter`
`systemctl start bgpalerter`