Skip to content

Commit

Permalink
add systemd service configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalvatori committed Mar 29, 2019
1 parent afe3528 commit 18d5b34
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
23 changes: 23 additions & 0 deletions contrib/README.md
@@ -0,0 +1,23 @@
# Create systemd service

Copy zbot service definition.
```
sudo cp zbot.service /etc/systemd/system/zbot.service
sudo cp zbot.default /etc/default/zbot
sudo chmod 664 /etc/systemd/system/zbot.service
```

Enable and start zbot service

```
sudo systemctl daemon-reload
sudo systemctl enable zbot
sudo systemctl start zbot
sudo systemctl status zbot
```

Create symlink

````
sudo ln -s /path/to//zbot-telegram-go-linux-amd64 /usr/local/bin/zbot
```
10 changes: 10 additions & 0 deletions contrib/zbot.default
@@ -0,0 +1,10 @@
#!/bin/bash

#ZBOT configuration

ZBOT_TOKEN=""
ZBOT_LOG_LEVEL=debug
ZBOT_DATABASE_TYPE=sqlite
ZBOT_MODULES_PATH="/home/zbot/modules"
ZBOT_DISABLED_COMMANDS="/home/zbot/disabled_commands.json"
ZBOT_SQLITE_DATABASE="/home/zbot/db/database.db"
12 changes: 12 additions & 0 deletions contrib/zbot.service
@@ -0,0 +1,12 @@
[Unit]
Description=Zbot as a Service

[Service]
EnvironmentFile=/etc/default/zbot
ExecStart=/usr/local/bin/zbot
ExecStop=kill $(ps aux | grep '/usr/local/bin/zbot' | grep -v grep | awk '{print $2}')
User=zbot
Group=zbot

[Install]
WantedBy=multi-user.target

0 comments on commit 18d5b34

Please sign in to comment.