Skip to content

Commit 06e8bbb

Browse files
author
Kristan Kenney
committed
Add v-delete-user-log
Deletes a users log file Usage: v-delete-user-log <user>
1 parent 184a22a commit 06e8bbb

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

bin/v-delete-user-log

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

0 commit comments

Comments
 (0)