Skip to content

Running as a service

To create & start a Trapster service, you need to run the following commands. It will download the project in /opt/trapster-community, and create a config directory in /etc/trapster-community. You can then start and stop the service using the service command.

bash
# Clone the repository in /opt/
git clone https://github.com/0xBallpoint/trapster-community/ /opt/trapster-community
cd /opt/trapster-community
python3 -m venv venv
source venv/bin/activate
python3 -m pip install .

# Create a config directory in /etc/
mkdir /etc/trapster-community/
cp /opt/trapster-community/trapster/data/trapster.conf /etc/trapster-community/

# Create a systemd service file in /etc/systemd/system/
echo '[Unit]
Description=Trapster Community
After=network-online.target

[Service]
Type=simple
ExecStart=/opt/trapster-community/venv/bin/python3 /opt/trapster-community/main.py -c /etc/trapster-community/trapster.conf
Restart=always
RestartSec=20

StandardOutput=append:/var/log/trapster.log
StandardError=append:/var/log/trapster.log

[Install]
WantedBy=multi-user.target' > /etc/systemd/system/trapster-community.service

# Start the service
service trapster-community start
service trapster-community status

You can then start and stop the service using the service command.

bash
service trapster-community start
service trapster-community stop
service trapster-community status