Compare commits
3 Commits
07826b59cf
...
c9b20d9826
Author | SHA1 | Date |
---|---|---|
Yasen Pramatarov | c9b20d9826 | |
Yasen Pramatarov | 979e910f1f | |
Yasen Pramatarov | 24de1dbf82 |
|
@ -1,3 +1,4 @@
|
||||||
*.log
|
*.log
|
||||||
*.log.*
|
*.log.*
|
||||||
jitsi-stats.db
|
jitsi-stats.db
|
||||||
|
jilo.db
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# jilo.conf - configuration variables for JItso Log Observer
|
||||||
|
LOGFILE="./jvb.log"
|
||||||
|
ROTATED_LOGFILE="./jvb.log.1"
|
||||||
|
DB="./jilo.db"
|
|
@ -1,12 +1,25 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
### Variables
|
### Default configuration
|
||||||
|
|
||||||
# log files
|
# default log files
|
||||||
LOGFILE="./jvb.log"
|
DEFAULT_LOGFILE="./jvb.log"
|
||||||
ROTATED_LOGFILE="./jvb.log.1"
|
DEFAULT_ROTATED_LOGFILE="./jvb.log.1"
|
||||||
# SQLite database file
|
# Default SQLite database file
|
||||||
DB="./jitsi-stats.db"
|
DEFAULT_DB="./jitsi-stats.db"
|
||||||
|
|
||||||
|
# Configuration file
|
||||||
|
CONFIG_FILE="./jilo.conf"
|
||||||
|
|
||||||
|
# Load configurations from the config file if it exists
|
||||||
|
if [[ -f "$CONFIG_FILE" ]]; then
|
||||||
|
source "$CONFIG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# use default values if not overriden by config file
|
||||||
|
LOGFILE=${LOGFILE:-$DEFAULT_LOGFILE}
|
||||||
|
ROTATED_LOGFILE=${ROTATED_LOGFILE:-$DEFAULT_ROTATED_LOGFILE}
|
||||||
|
DB=${DB:-$DEFAULT_DB}
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
@ -187,6 +200,18 @@ case "$cmd" in
|
||||||
|
|
||||||
--check)
|
--check)
|
||||||
|
|
||||||
|
# First check if database exists
|
||||||
|
if [[ ! -f $"DB" ]]; then
|
||||||
|
echo "Database not found. If it's a fresh install, please install the database first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check the state table
|
||||||
|
if ! sqlite3 "$DB" ".schema state" &>/dev/null; then
|
||||||
|
echo "The database doesn't contain the required table \"state\". Please check it, and if needed, reinstall it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Retrieve last log file and position inside it
|
# Retrieve last log file and position inside it
|
||||||
IFS='|' read -r last_file last_filetime last_size last_pos last_inode <<< $(get_state)
|
IFS='|' read -r last_file last_filetime last_size last_pos last_inode <<< $(get_state)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue