This repository has been archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
update_journal_log.sh
59 lines (52 loc) · 2.07 KB
/
update_journal_log.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
####################################################################################
# If not stated otherwise in this file or this component's Licenses.txt file the
# following copyright and licenses apply:
#
# Copyright 2018 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##################################################################################
#update dmesg log into rdklogs/logs/messages.txt
. /etc/device.properties
. /etc/utopia/service.d/log_env_var.sh
current_time=0
lastync_time=0
BootupLog_is_updated=0
while [ 1 ]
do
current_time=$(date +%s)
if [ -f "$lastdmesgsync" ];then
lastsync_time=`cat $lastdmesgsync`
fi
difference_time=$(( current_time - lastsync_time ))
lastsync_time=$current_time
echo "$current_time" > $lastdmesgsync
#Keeps appending to the existing file
nice -n 19 journalctl -k --since "${difference_time} sec ago" >> ${DMESG_FILE}
if [ "$BOX_TYPE" = "XB6" ] || [ "$BOX_TYPE" = "XF3" ] || [ "$BOX_TYPE" = "TCCBR" ];then
#ARRISXB6-7973: Complete journalctl logs to /rdklogs/logs/journal_logs.txt.0
uptime_in_secs=$(cut -d. -f1 /proc/uptime)
if [ $uptime_in_secs -ge 240 ] && [ $BootupLog_is_updated -eq 0 ]; then
nice -n 19 journalctl > ${journal_log}
BootupLog_is_updated=1;
fi
fi
# ARRISXB6-8252 sleep for 60 sec until we populate journalctl
if [ "$BOX_TYPE" = "XB6" -a "$MANUFACTURE" = "Arris" ];then
dmesgsyncinterval=60
else
dmesgsyncinterval=`syscfg get dmesglogsync_interval`
fi
sleep $dmesgsyncinterval
done