File tree Expand file tree Collapse file tree 6 files changed +89
-0
lines changed
Expand file tree Collapse file tree 6 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # info: Enable cgroup support for user
3+ # options: NONE
4+ #
5+ # example: v-add-sys-cgroup
6+
7+ # ----------------------------------------------------------#
8+ # Variables & Functions #
9+ # ----------------------------------------------------------#
10+
11+ # Includes
12+ # shellcheck source=/etc/hestiacp/hestia.conf
13+ source /etc/hestiacp/hestia.conf
14+ # shellcheck source=/usr/local/hestia/func/main.sh
15+ source $HESTIA /func/main.sh
16+ # load config file
17+ source_conf " $HESTIA /conf/hestia.conf"
18+
19+ # ----------------------------------------------------------#
20+ # Verifications #
21+ # ----------------------------------------------------------#
22+
23+ # Perform verification if read-only mode is enabled
24+ check_hestia_demo_mode
25+
26+ # ----------------------------------------------------------#
27+ # Action #
28+ # ----------------------------------------------------------#
29+
30+ # Updating hestia.conf value
31+ $BIN /v-change-sys-config-value " RESOURCES_LIMIT" " yes"
32+
33+ # enable cgroup for all users
34+ for user in $( " $BIN /v-list-users" list) ; do
35+ $BIN /v-update-user-cgroup " $user "
36+ done
37+
38+ # Reload daemon
39+ systemctl daemon-reload
40+
41+ # ----------------------------------------------------------#
42+ # Hestia #
43+ # ----------------------------------------------------------#
44+
45+ # Logging
46+ $BIN /v-log-action " system" " Info" " Plugins" " System cgroup Enforcement Enabled."
47+ log_event " $OK " " $ARGUMENTS "
48+
49+ exit
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ json_list() {
8585 "PROXY_SSL_PORT": "' $PROXY_SSL_PORT ' ",
8686 "PROXY_SYSTEM": "' $PROXY_SYSTEM ' ",
8787 "RELEASE_BRANCH": "' $RELEASE_BRANCH ' ",
88+ "RELEASE_BRANCH": "' $RELEASE_BRANCH ' ",
89+ "RESOURCES_LIMIT": "' $RESOURCES_LIMIT ' ",
8890 "REPOSITORY": "' $REPOSITORY ' ",
8991 "ROOT_USER": "' $ROOT_USER ' ",
9092 "SERVER_SMTP_ADDR": "' $SERVER_SMTP_ADDR ' ",
Original file line number Diff line number Diff line change 7373
7474# Apply change immediately: not needed for now
7575# systemctl restart "$user_slice"
76+
7677# ----------------------------------------------------------#
7778# Hestia #
7879# ----------------------------------------------------------#
Original file line number Diff line number Diff line change 582582 }
583583 }
584584
585+ // Set disk_quota support
586+ if (empty ($ _SESSION ["error_msg " ])) {
587+ if (
588+ !empty ($ _POST ["v_resources_limit " ]) &&
589+ $ _SESSION ["RESOURCES_LIMIT " ] != $ _POST ["v_resources_limit " ]
590+ ) {
591+ if ($ _POST ["v_resources_limit " ] == "yes " ) {
592+ exec (HESTIA_CMD . "v-add-sys-cgroups " , $ output , $ return_var );
593+ check_return_code ($ return_var , $ output );
594+ unset($ output );
595+ if (empty ($ _SESSION ["error_msg " ])) {
596+ $ _SESSION ["RESOURCES_LIMIT " ] = "yes " ;
597+ }
598+ } else {
599+ exec (HESTIA_CMD . "v-delete-sys-cgroups " , $ output , $ return_var );
600+ check_return_code ($ return_var , $ output );
601+ unset($ output );
602+ if (empty ($ _SESSION ["error_msg " ])) {
603+ $ _SESSION ["RESOURCES_LIMIT " ] = "no " ;
604+ }
605+ }
606+ }
607+ }
608+
585609 // Set firewall support
586610 if (empty ($ _SESSION ["error_msg " ])) {
587611 if ($ _SESSION ["FIREWALL_SYSTEM " ] == "iptables " ) {
Original file line number Diff line number Diff line change @@ -1401,6 +1401,19 @@ class="form-select"
14011401 </option>
14021402 </select>
14031403 </div>
1404+ <div class="u-mb10">
1405+ <label for="v_resources_limit" class="form-label">
1406+ <?= _ ("Limit System Resources " ) ?>
1407+ </label>
1408+ <select class="form-select" name="v_resources_limit" id="v_resources_limit">
1409+ <option value="no">
1410+ <?= _ ("No " ) ?>
1411+ </option>
1412+ <option value="yes" <?= $ _SESSION ["RESOURCES_LIMIT " ] == "yes " ? "selected " : "" ?> >
1413+ <?= _ ("Yes " ) ?>
1414+ </option>
1415+ </select>
1416+ </div>
14041417 <div class="u-mb10">
14051418 <label for="v_quota" class="form-label">
14061419 <?= _ ("File System Disk Quota " ) ?>
You can’t perform that action at this time.
0 commit comments