-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall-Dynamic_Dns_Update_Client.bash
More file actions
executable file
·45 lines (36 loc) · 1.14 KB
/
Install-Dynamic_Dns_Update_Client.bash
File metadata and controls
executable file
·45 lines (36 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
version="v0.0.2"
jar_url="https://github.com/Henriquemcc/Dynamic_DNS_Update_Client/releases/download/${version}/app.jar"
jar_download_destination="/usr/bin/Dynamic_Dns_Update_Client.jar"
service_name="dynamic-dns-update-client.service"
service_file_path="/etc/systemd/system/${service_name}"
# Importing function run_as_root
source RunAsRoot.bash
# Running as root
run_as_root
# Installing requirements
if ! [ "$(command -v java)" ]; then
bash ./Install-Java_21_Headless.bash
fi
# Downloading JAR File
curl -L "$jar_url" -o "$jar_download_destination"
# Changing permission for the downloaded file
chmod +x "$jar_download_destination"
# Creating system service
{
echo "[Unit]"
echo "Description=Dynamic dns update client service"
echo "After=network.target"
echo "StartLimitIntervalSec=0"
echo ""
echo "[Service]"
echo "Type=simple"
echo "Restart=always"
echo "RestartSec=1"
echo "User=root"
echo "ExecStart=/usr/bin/java -jar ${jar_download_destination} perform-ip-update -i"
echo "[Install]"
echo "WantedBy=multi-user.target"
} > "$service_file_path"
# Enabling System Service
systemctl enable --now "$service_name"