Skip to content

Commit a12c3a2

Browse files
author
Kristan Kenney
committed
Initial commit of v-change-sys-demo-mode
1 parent 782c155 commit a12c3a2

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

bin/v-change-sys-demo-mode

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# info: enable or disable demo mode
3+
#
4+
# This function will set the demo mode variable,
5+
# which will prevent usage of certain v-scripts in the backend
6+
# and prevent modification of objects in the control panel.
7+
#
8+
# It will also disable virtual hosts for Apache and NGINX
9+
# for domains which have been created.
10+
11+
12+
#----------------------------------------------------------#
13+
# Variable&Function #
14+
#----------------------------------------------------------#
15+
16+
mode=$1
17+
18+
# Includes
19+
source $HESTIA/func/main.sh
20+
source $HESTIA/conf/hestia.conf
21+
22+
#----------------------------------------------------------#
23+
# Action #
24+
#----------------------------------------------------------#
25+
26+
if [ -z "$mode" ]; then
27+
echo "ERROR: No mode specified."
28+
echo "Usage: v-change-sys-demo-mode [no|yes]"
29+
exit 1
30+
elif [ "$mode" = "yes" ]; then
31+
#TO-DO: Instructions for disabling vhosts
32+
$BIN/v-change-sys-config-value 'DEMO_MODE' "$mode"
33+
elif [ "$mode" = "no" ]; then
34+
#TODO: Instructions for enabling vhosts
35+
$BIN/v-change-sys-config-value 'DEMO_MODE' "$mode"
36+
else
37+
echo "ERROR: Invalid mode specified."
38+
echo "Valid modes:"
39+
echo "no: Disables read only / demo mode."
40+
echo "yes: Enables read only / demo mode."
41+
exit 1
42+
fi
43+
44+
#----------------------------------------------------------#
45+
# Hestia #
46+
#----------------------------------------------------------#
47+
48+
# Restarting web server
49+
$BIN/v-restart-web $restart
50+
check_result $? "restart" >/dev/null 2>&1
51+
52+
$BIN/v-restart-proxy $restart
53+
check_result $? "restart" >/dev/null 2>&1
54+
55+
exit

0 commit comments

Comments
 (0)