Skip to content

Commit a1fbc18

Browse files
committed
Update installation instructions by adding systemd scripts
1 parent ad25148 commit a1fbc18

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

README.md

+31-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,36 @@ on other distributions.
1313

1414
sudo apt install php-cli php-xml php-curl
1515

16-
Make configuration file
16+
Make configuration file:
1717

18-
cp config.json.example config.json
18+
cp example/config.json config.json
1919

20-
And edit it to match your setup
20+
And edit it to match your setup.
21+
22+
Then run manually for the first time:
23+
24+
./bot
25+
26+
## Systemd timer
27+
28+
To get it running periodically, we use systemd. See example
29+
configurations in [example/](example/) subdirectory.
30+
31+
Copy example files to systemd:
32+
33+
```sh
34+
sudo cp example/redmine-irc.* /etc/systemd/system
35+
sudo chown root:root /etc/systemd/system/redmine-irc.*
36+
```
37+
38+
Edit `/etc/systemd/system/redmine-irc.service` to match with your
39+
installation directory, user name, and group. Then run:
40+
41+
```sh
42+
sudo systemctl daemon-reload
43+
sudo systemctl enable redmine-irc.timer
44+
sudo systemctl start redmine-irc.timer
45+
```
46+
47+
That shoud keep it running for every 5 minutes. To change the running
48+
interval, edit `/etc/systemd/system/redmine-irc.timer`.
File renamed without changes.

example/redmine-irc.service

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Prasos Redmine to IRC bot
3+
After=network-online.target
4+
5+
[Service]
6+
Type=oneshot
7+
User=YOUR_USER
8+
Group=YOUR_GROUP
9+
ExecStart=/YOUR/PATH/bot

example/redmine-irc.timer

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Run Redmine to IRC bot periodically
3+
4+
[Timer]
5+
OnCalendar=*:0/5
6+
Persistent=true
7+
8+
[Install]
9+
WantedBy=timers.target

0 commit comments

Comments
 (0)