Skip to content

Commit 069ab6e

Browse files
author
Kristan Kenney
committed
Initial commit: v-log-event
1 parent 66f19e1 commit 069ab6e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

bin/v-log-event

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# info: adds an event to the appropriate log
3+
# options: LOG_TYPE USER
4+
5+
# Argument definition
6+
log_type=$1
7+
event_type=$2
8+
user=$3
9+
message=$4
10+
11+
# Includes
12+
source $HESTIA/func/main.sh
13+
source $HESTIA/conf/hestia.conf
14+
15+
#----------------------------------------------------------#
16+
# Verifications #
17+
#----------------------------------------------------------#
18+
19+
check_args '4' "$#" 'LOG_TYPE EVENT_TYPE USER MESSAGE'
20+
is_format_valid 'user' 'ip'
21+
is_object_valid 'user' 'USER' "$user"
22+
23+
# Generating timestamp
24+
time_n_date=$(date +'%T %F')
25+
time=$(echo "$time_n_date" |cut -f 1 -d \ )
26+
date=$(echo "$time_n_date" |cut -f 2 -d \ )
27+
28+
29+
#----------------------------------------------------------#
30+
# Action #
31+
#----------------------------------------------------------#
32+
33+
34+
35+
36+
37+
#----------------------------------------------------------#
38+
# Hestia #
39+
#----------------------------------------------------------#
40+
41+
exit

0 commit comments

Comments
 (0)