forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv-add-sys-web-terminal
More file actions
executable file
·57 lines (46 loc) · 1.73 KB
/
v-add-sys-web-terminal
File metadata and controls
executable file
·57 lines (46 loc) · 1.73 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
51
52
53
54
55
56
57
#!/bin/bash
# info: add system web terminal
# options: NONE
#
# example: v-add-sys-web-terminal
#
# This function enables the web terminal.
#----------------------------------------------------------#
# Variables & Functions #
#----------------------------------------------------------#
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
if [ "$WEB_TERMINAL" = 'true' ]; then
exit
fi
# Perform verification if read-only mode is enabled
check_hestia_demo_mode
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Updating WEB_TERMINAL value
$BIN/v-change-sys-config-value "WEB_TERMINAL" "true"
# Check if nodejs and hestia-web-terminal are installed
if [ ! -f "/usr/bin/node" ] || [ ! -f "$HESTIA/web-terminal/server.js" ]; then
apt-get -qq update
apt-get -qq install nodejs hestia-web-terminal -y
else
# Starting web terminal websocket server
$BIN/v-start-service "hestia-web-terminal"
systemctl enable hestia-web-terminal
fi
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
# Logging
$BIN/v-log-action "system" "Info" "Web Terminal" "Web terminal enabled."
log_event "$OK" "$ARGUMENTS"
exit