Использование Go-DHT v1.1.0
This commit is contained in:
parent
779441cc5c
commit
a507916ff3
@ -2,3 +2,7 @@
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://pkg.go.dev/gitfox.ru/victor/dht-exporter)
|
||||

|
||||

|
||||

|
||||

|
||||
|
@ -2,3 +2,7 @@
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://pkg.go.dev/gitfox.ru/victor/dht-exporter)
|
||||

|
||||

|
||||

|
||||

|
||||
|
2
go.mod
2
go.mod
@ -2,4 +2,4 @@ module gitfox.ru/victor/dht-exporter
|
||||
|
||||
go 1.22
|
||||
|
||||
require gitfox.ru/victor/go-dht v1.0.5
|
||||
require gitfox.ru/victor/go-dht v1.1.0
|
||||
|
@ -1,10 +1,17 @@
|
||||
# Install DHT Exporter service
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://pkg.go.dev/gitfox.ru/victor/dht-exporter)
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
1. Run make in the parent directory - **dht-exporter** application must be created.
|
||||
2. Edit file **service.conf**:
|
||||
- `InstallPrefix` - **dht-exporter** install location (default: */bin*).
|
||||
- `EnvirionmentPrefix` - environment configuration location (default: */etc/default*).
|
||||
- `User` - service user (default: *nobody*).
|
||||
- `User` - service user (default: *root*).
|
||||
- `Options` - command-line options. Use *dht-exporter -h* for help.
|
||||
3. Run installation script
|
||||
```shell
|
||||
|
@ -1,4 +1,4 @@
|
||||
#
|
||||
# Command-line options for DHT Exporter
|
||||
# Command-line options for Prometheus DHT Exporter
|
||||
#
|
||||
%%OPTS%%
|
||||
|
@ -4,24 +4,24 @@ svcName="dht-exporter"
|
||||
systemdPath="/usr/lib/systemd/system"
|
||||
|
||||
if [ $UID != 0 ]; then
|
||||
echo "You must have root privilges!"
|
||||
echo "You must have a root privilges!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x ../$svcName ]; then
|
||||
echo "FAILED: '$svcName' not found in the parent directory!"
|
||||
echo "Use make to build app..."
|
||||
echo "Use 'make' command to build application."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. service.conf || {
|
||||
echo "WARNING: Service comfiguration is not found!"
|
||||
echo "Using default parameters..."
|
||||
echo "WARNING: Service configuration not found!"
|
||||
echo "Using default options."
|
||||
}
|
||||
|
||||
InstallPrefix=${InstallPrefix:-/usr/bin}
|
||||
EnvironmentPrefix=${EnvironmentPrefix:-/etc/default}
|
||||
User=${User:-nobody}
|
||||
User=${User:-root}
|
||||
|
||||
echo "Service location : $InstallPrefix/$svcName"
|
||||
echo "Environment path : $EnvironmentPrefix/$svcName"
|
||||
@ -42,5 +42,4 @@ rm -f /tmp/$svcName.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable dht-exporter.service
|
||||
systemctl start dht-exporter.service
|
||||
|
||||
echo "Install complete!"
|
||||
|
@ -1,4 +1,4 @@
|
||||
InstallPrefix=/bin
|
||||
EnvironmentPrefix=/etc/default
|
||||
User=nobody
|
||||
Options="-pin 7 -data-file=/tmp/dht22.txt"
|
||||
User=root
|
||||
Options="-pin 7 -data-file=/var/log/dht22.txt"
|
||||
|
@ -5,26 +5,27 @@ systemdPath="/usr/lib/systemd/system"
|
||||
systemdLink="/etc/systemd/system"
|
||||
|
||||
if [ $UID != 0 ]; then
|
||||
echo "You must have root privilges!"
|
||||
echo "You must have a root privilges!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. service.conf || {
|
||||
echo "WARNING: Service comfiguration is not found!"
|
||||
echo "Using default parameters..."
|
||||
echo "WARNING: Service configuration not found!"
|
||||
echo "Using default options."
|
||||
}
|
||||
|
||||
InstallPrefix=${InstallPrefix:-/usr/bin}
|
||||
EnvironmentPrefix=${EnvironmentPrefix:-/etc/default}
|
||||
User=${User:-nobody}
|
||||
User=${User:-root}
|
||||
|
||||
|
||||
if [ -f "$systemdPath/$svcName.service" ]; then
|
||||
systemctl stop $svcName.service
|
||||
systemctl disable $svcName.service
|
||||
rm -f $InstallPrefix/dht-exporter $EnvironmentPrefix/dht-exporter $systemdLink/$svcName.service $systemdPath/$svcName.service
|
||||
systemctl daemon-reload
|
||||
echo "Uninstall complete!"
|
||||
else
|
||||
echo "Service $svcName is not installed!"
|
||||
if [ ! -f "$systemdPath/$svcName.service" ]; then
|
||||
echo "Service $svcName not installed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Uninstalling service..."
|
||||
systemctl stop $svcName.service
|
||||
systemctl disable $svcName.service
|
||||
rm -f $InstallPrefix/dht-exporter $EnvironmentPrefix/dht-exporter $systemdLink/$svcName.service $systemdPath/$svcName.service
|
||||
systemctl daemon-reload
|
||||
echo "Uninstall complete!"
|
||||
|
Loading…
x
Reference in New Issue
Block a user