Skip to content

Commit 5938059

Browse files
author
Kristan Kenney
committed
Rename script to v-log-action
1 parent 526e648 commit 5938059

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

bin/v-log-event renamed to bin/v-log-action

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
2-
# info: adds an event to the appropriate log
2+
# info: adds action event to user or system log
33
# options: LOG_TYPE USER
44

55
# Argument definition
66
log_type=$1
77
event_type=$2
88
user=$3
9-
message=$4
9+
event_details=${4-$3}
10+
11+
echo $event_details
1012

1113
# Includes
1214
source $HESTIA/func/main.sh
@@ -16,33 +18,29 @@ source $HESTIA/conf/hestia.conf
1618
# Verifications #
1719
#----------------------------------------------------------#
1820

19-
check_args '4' "$#" 'LOG_TYPE EVENT_TYPE USER MESSAGE'
20-
is_format_valid 'user' 'ip'
21-
is_object_valid 'user' 'USER' "$user"
22-
2321
# Generating timestamp
2422
time_n_date=$(date +'%T %F')
2523
time=$(echo "$time_n_date" |cut -f 1 -d \ )
2624
date=$(echo "$time_n_date" |cut -f 2 -d \ )
2725

28-
2926
#----------------------------------------------------------#
3027
# Action #
3128
#----------------------------------------------------------#
3229

33-
3430
# Provide context switch for different log types
3531
if [ "$log_type" = "user" ]; then
36-
log_history "$message" '' "$user"
32+
check_args '4' "$#" 'LOG_TYPE EVENT_TYPE USER MESSAGE'
33+
is_object_valid 'user' 'USER' "$user"
34+
log_history "'$event_details" '' "$user"
3735
exit
3836
fi
3937

4038
if [ "$log_type" = "system" ]; then
41-
log_history "$message" '' 'admin'
39+
check_args '3' "$#" 'LOG_TYPE EVENT_TYPE MESSAGE'
40+
log_history "$event_details" '' 'admin'
4241
exit
4342
fi
4443

45-
4644
#----------------------------------------------------------#
4745
# Hestia #
4846
#----------------------------------------------------------#

0 commit comments

Comments
 (0)