v-delete-user-log 913 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # info: Delete log file for user
  3. #
  4. # The function for deleting a users log file
  5. #----------------------------------------------------------#
  6. # Variable&Function #
  7. #----------------------------------------------------------#
  8. # Argument definition
  9. user=$1
  10. date=$(date "+%F %T")
  11. # Includes
  12. source $HESTIA/func/main.sh
  13. source $HESTIA/conf/hestia.conf
  14. #----------------------------------------------------------#
  15. # Action #
  16. #----------------------------------------------------------#
  17. # Remove log file
  18. if [ -z $user ]; then
  19. echo "Error: no user specified."
  20. elif [ ! -f "$HESTIA/data/users/$user/history.log" ]; then
  21. echo "Error: no history log found for $user."
  22. else
  23. rm -f $HESTIA/data/users/$user/history.log
  24. fi
  25. log_history "Log for $user was cleared on $date."
  26. log_event "$OK" "$ARGUMENTS"
  27. exit