forked from enwaiax/peer2profit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p2p-service.sh
executable file
·61 lines (49 loc) · 1.34 KB
/
p2p-service.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# This script is used to start the p2pclient.
# Will only support Debian and Ubuntu based systems.
p2pclient_deb_url="https://updates.peer2profit.app/p2pclient_0.60_amd64.deb"
export email="$1"
if [ -z "$email" ]; then
read -rp "Input your email: " email
export email
fi
function install_dependencies() {
echo "Installing dependencies..."
apt update -qq &>/dev/null && apt get install -y -qq curl &>/dev/null
}
function install_p2p_service() {
echo "Installing p2pclient..."
wget $p2pclient_deb_url -O p2pclient.deb
dpkg -i p2pclient.deb
rm -f p2pclient.deb
}
function start_p2p_service() {
echo "Starting peer2profit..."
ip=$(curl -4fsSLk ip.sb)
if [ -f /etc/systemd/system/peer2profit.service ]; then
systemctl disable peer2profit
systemctl stop peer2profit
rm -f /etc/systemd/system/peer2profit.service
fi
cat >/etc/systemd/system/peer2profit.service <<EOF
[Unit]
Description=peer2profit
[Service]
Type=simple
ExecStart=/usr/bin/p2pclient -l $email -n "$ip;8.8.8.8,1.1.1.1"
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable peer2profit
systemctl start peer2profit
systemctl status peer2profit
}
function main() {
install_dependencies
install_p2p_service
start_p2p_service
}
main "$@"