-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall-host-services.sh
More file actions
executable file
·51 lines (44 loc) · 1.7 KB
/
install-host-services.sh
File metadata and controls
executable file
·51 lines (44 loc) · 1.7 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
45
46
47
48
49
50
#!/bin/bash
## Host service installer for OperationHub
set -e
. /etc/os-release
# install python3 environment
if printf '%s\n' $(echo ${ID_LIKE[@]}) | grep -qx "rhel"; then
yum install -y epel-release
yum install -y python3 python3-devel python3-libs python3-pip inotify-tools
pip3 install tornado
elif [ $ID == "ubuntu" ]; then
apt-get update
apt-get install -y python3 python3-dev python3-pip inotify-tools
apt-get install -y python3-tornado
else
exit 1
fi
# install service
install -m 644 host-service/ophubuser.py /usr/local/bin
curl -o /usr/local/bin/restuser.py https://raw.githubusercontent.com/minrk/restuser/master/restuser.py
install -m 755 host-service/copy-passwd.sh /usr/local/bin
# install systemd unit files
install -m 644 host-service/ophubuser.service /etc/systemd/system
install -m 644 host-service/restuser.service /etc/systemd/system
install -m 644 host-service/copy-passwd.service /etc/systemd/system
# enable and start services
systemctl daemon-reload
systemctl enable restuser.service
systemctl -q is-active restuser.service \
&& systemctl stop restuser.service
systemctl start restuser.service
systemctl enable ophubuser.service
systemctl -q is-active ophubuser.service \
&& systemctl stop ophubuser.service
systemctl start ophubuser.service
[ -e /etc/systemd/system/copy-passwd.path ] \
&& systemctl -q is-enabled copy-passwd.path \
&& systemctl disable copy-passwd.path
[ -e /etc/systemd/system/copy-passwd.path ] \
&& systemctl -q is-active copy-passwd.path \
&& systemctl stop copy-passwd.path
systemctl enable copy-passwd.service
systemctl -q is-active copy-passwd.service \
&& systemctl stop copy-passwd.service
systemctl start copy-passwd.service