v-delete-user-auth-log 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. # info: Delete auth log file for user
  3. #
  4. # The function for deleting a users auth log file
  5. #----------------------------------------------------------#
  6. # Variable&Function #
  7. #----------------------------------------------------------#
  8. # Argument definition
  9. user=$1
  10. # Includes
  11. # shellcheck source=/usr/local/hestia/func/main.sh
  12. source $HESTIA/func/main.sh
  13. # shellcheck source=/usr/local/hestia/conf/hestia.conf
  14. source $HESTIA/conf/hestia.conf
  15. # Perform verification if read-only mode is enabled
  16. check_hestia_demo_mode
  17. #----------------------------------------------------------#
  18. # Verifications #
  19. #----------------------------------------------------------#
  20. check_args '1' "$#" 'USER'
  21. is_format_valid 'user'
  22. is_object_valid 'user' 'USER' "$user"
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. # Remove log file and log event
  27. if [ -f $USER_DATA/auth.log ]; then
  28. rm -f $USER_DATA/auth.log
  29. log_history "login history for $user was cleared."
  30. log_event "$OK" "$ARGUMENTS"
  31. fi
  32. exit