Index: generate_logs |
diff --git a/generate_logs b/generate_logs |
deleted file mode 100755 |
index dfcdeea63d60294f04fb1450d15434a95e68a064..0000000000000000000000000000000000000000 |
--- a/generate_logs |
+++ /dev/null |
@@ -1,82 +0,0 @@ |
-#!/bin/sh |
-# |
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
-# Use of this source code is governed by a BSD-style license that can be |
-# found in the LICENSE file. |
-# |
-# Copies all logs, screen-shots, crash dumps to Downloads folder. |
- |
-# Help information about script usage |
-if ([ "$1" = -h ] || [ "$1" = -? ]); then |
- echo "Usage of generate_logs script:" |
- echo "To collect logs, dumps and screenshots: sh $0" |
- echo "To collect data and clear up folders: sh $0 --delete" |
- echo "Collected data is zipped to tar.bz2 file with timestamp in Downloads" |
- exit 1 |
-fi |
- |
-echo "Collecting logs for $USER user" |
-home_dir=/home/$USER/user |
- |
-# Creating folder to copy logs, screenshots and dumps |
-log_dir=$home_dir/Downloads/diagnostic_logs |
-mkdir -p $log_dir |
-sudo rm -rf $log_dir/* |
-echo "Created log folder in Downloads" |
- |
-# Copying file with current timestamp and date |
-date > $log_dir/timestamp.txt |
-echo "Copied current timestamp" |
- |
-# Copying lsb-release file |
-sudo cp /etc/lsb-release $log_dir |
-echo "Copied lsb-release file with version information" |
- |
-# Copying logs- windows manager, screen-locker, messages, session_manager |
-mkdir $log_dir/system_level_logs |
-cp -r /var/log/messages \ |
- /var/log/session_manager \ |
- /var/log/softwareupdate.log \ |
- /var/log/update_engine.log \ |
- /var/log/window_manager \ |
- $log_dir/system_level_logs |
-cp -rf $home_dir/log $log_dir/user_level_logs |
-echo "Copied relevant logs" |
- |
-# Copying screen-shots |
-cp -rf $home_dir/Downloads/Screenshots $log_dir/screenshots 2> /dev/null && \ |
- echo "Copied screen-shots" |
- |
-# Copying crash dumps and deleting from original location |
-cp -rf $home_dir/.config/google-chrome/Crash\ Reports $log_dir/crashdumps 2> \ |
- /dev/null && echo "Copied crash dumps" |
- |
-# Compressing the log folder with all collected files |
-currentdate=$(date +%m%d%y-%H%M%S) |
-tar cjfP $home_dir/Downloads/log-$currentdate.tar.bz2 $log_dir/ |
-sudo rm -rf $log_dir/* |
-echo "Files zipped to folder under Downloads : log-$currentdate.tar.bz2" |
- |
-# Deleting logs, dumps, screenshots from original location with flag -delete |
-if [ "$1" = --delete ]; then |
- echo "Deleting all logs " |
- sudo rm -rf /var/log/messages \ |
- /var/log/session_manager \ |
- /var/log/softwareupdate.log \ |
- /var/log/update_engine.log \ |
- /var/log/window_manager/* |
- sudo rm -rf $home_dir/log/* |
- |
- echo "Deleting crash dumps" |
- sudo rm -rf $home_dir/.config/google-chrome/Crash\ Reports/* |
- |
- echo "Deleting screen-shots" |
- sudo rm -rf $home_dir/Downloads/Screenshots/* |
- |
- # Reboot after deleting all files |
- echo "Rebooting system after clean up in 1 minute" |
- sudo shutdown -r 1 |
-else |
- echo "Logs and dumps are copied but not deleted." |
- echo "To clear all logs, run the script with --delete flag" |
-fi |