File tree 2 files changed +59
-0
lines changed
2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ diskmon -basedir <directory> -limit 65 \
66
66
67
67
so that the credentials are not in your shell history.
68
68
69
+ ### Running as a service
70
+
71
+ Read [ Running diskmon as a service] ( ./examples/README.md ) .
72
+
69
73
## Build from source
70
74
71
75
You need to have [ Go 1.16] ( https://golang.org ) installed to build the binary yourself.
Original file line number Diff line number Diff line change
1
+ # Running diskmon as a service
2
+
3
+ [ systemd] ( https://systemd.io/ )
4
+ > systemd is a suite of basic building blocks for a Linux system. It provides a
5
+ > system and service manager that runs as PID 1 and starts the rest of the
6
+ > system.
7
+
8
+ I provide a simple systemd [ service file] ( ./diskmon.service ) that demonstrates
9
+ how you might be able to run diskmon as a service using ` systemd ` . You will
10
+ need to adjust paths to diskmon and mount points and flags to fit your
11
+ environment and needs.
12
+
13
+ ## Installation
14
+
15
+ Install the diskmon service
16
+
17
+ ``` sh
18
+ sudo cp ./examples/diskmon.service /etc/systemd/system/diskmon.service
19
+ sudo chmod 664 /etc/systemd/system/diskmon.service
20
+ ```
21
+
22
+ Adapt the service file to your needs!
23
+
24
+ Start diskmon to see if systemd can start diskmon successfully
25
+
26
+ ``` sh
27
+ sudo systemctl start diskmon
28
+ ```
29
+
30
+ Check the service status
31
+
32
+ ``` sh
33
+ sudo systemctl status diskmon
34
+ ```
35
+
36
+ or the diskmon logs
37
+
38
+ ``` sh
39
+ sudo journalctl --follow --unit diskmon --boot
40
+ ```
41
+
42
+ If all went well, enable diskmon to start automatically at boot
43
+
44
+ ``` sh
45
+ sudo systemctl enable diskmon
46
+ ```
47
+
48
+ Reboot and check the status, logs again to see if all is well.
49
+
50
+ ## Limitations
51
+
52
+ * have not yet figured out how to securly pass the Slack API token. You could
53
+ incorporate a subshell command that for example calls your password manager
54
+ to pass the token in. This way you would not add the token in plain text into
55
+ the service file which is readable by others on your system.
You can’t perform that action at this time.
0 commit comments