Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: scripts/get_log

Issue 5430006: Include the 5 most recent update engine logs, up to 2000 lines in chrome:system. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/userfeedback.git@master
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « etc/sys_log_utils.lst ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # This script looks to see if a log file is zero length, or non 7 # This script looks to see if a log file is zero length, or non
8 # existent before writing something to stdout, so that we don't end up 8 # existent before writing something to stdout, so that we don't end up
9 # with empty entries that just look broken. 9 # with empty entries that just look broken.
10 10
11 max_lines=${2:-1000} 11 max_lines=${2:-1000}
12 file=$1
12 13
13 file=$1 14 [ "$file" = "/dev/stdin" ] && tail --lines=$max_lines "$file" && exit
15
14 if [ -h "$file" ]; then 16 if [ -h "$file" ]; then
15 file="$(readlink -f $file)" 17 file="$(readlink -f $file)"
16 fi 18 fi
17 19
18 if [ -r "$file" -a -f "$file" ]; then 20 if [ -r "$file" -a -f "$file" ]; then
19 size=$(/bin/ls -s "$file") 21 size=$(/bin/ls -s "$file")
20 # Get the first field. 22 # Get the first field.
21 size=${size%% *} 23 size=${size%% *}
22 if [ $size -gt 0 ]; then 24 if [ $size -gt 0 ]; then
23 /usr/bin/tail --lines=$max_lines "$file" 25 /usr/bin/tail --lines=$max_lines "$file"
24 else 26 else
25 echo "<empty>" 27 echo "<empty>"
26 fi 28 fi
27 else 29 else
28 echo "<not available>" 30 echo "<not available>"
29 fi 31 fi
OLDNEW
« no previous file with comments | « etc/sys_log_utils.lst ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698