v-delete-sys-cgroups 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # info: delete all cgroups
  3. # options: NONE
  4. #
  5. # example: v-delete-sys-cgroups
  6. #
  7. # This function disables cgroups
  8. #----------------------------------------------------------#
  9. # Variables & Functions #
  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. # Verifications #
  20. #----------------------------------------------------------#
  21. # Perform verification if read-only mode is enabled
  22. check_hestia_demo_mode
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Revert cgroup for all users
  27. for user in $("$BIN/v-list-users" list); do
  28. user_id=$(id -u "$user")
  29. user_slice="user-${user_id}.slice"
  30. systemctl revert "$user_slice"
  31. done
  32. # Reload daemon
  33. systemctl daemon-reload
  34. # Updating hestia.conf value
  35. $BIN/v-change-sys-config-value "RESOURCES_LIMIT" "no"
  36. #----------------------------------------------------------#
  37. # Hestia #
  38. #----------------------------------------------------------#
  39. # Logging
  40. $BIN/v-log-action "system" "Info" "Plugins" "System cgroup Enforcement disabled."
  41. log_event "$OK" "$ARGUMENTS"
  42. exit