File: powersave_logs

package info (click to toggle)
powersave 0.14.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,764 kB
  • ctags: 999
  • sloc: sh: 11,357; cpp: 8,103; ansic: 2,631; makefile: 388
file content (53 lines) | stat: -rwxr-xr-x 1,416 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

#
# Script to save the powersave logfiles. Intended to use for bugreports.
# So when something went wrong with powersave you simply have to execute
# this script. The resulting tarball in the current working directory
# contains the powersave logfiles.
#
# At the moment the logfiles are /var/log/suspend2disk.log and
# /var/log/suspend2ram.log. This may change in the future.
#
# Author:  Holger Macht
# Contact: hmacht@suse.de
#

LOGDIR="/var"
LOGFILES="log/suspend2disk.log log/suspend2ram.log log/standby.log"
STATEFILES="`echo lib/suspend2{disk,ram}-state{,.resume} lib/standby-state{,.resume}`"
ARCHIVE="powersave_logs.tar.gz"

echo -e "\nTrying to save powersave logfiles..."

CWD=`pwd`

# check if we could write to current working directory
touch powersave_logs.tmp >/dev/null 2>&1
if test "$?" != "0"; then
    echo "Warning: Unable to write to current working directory... using /tmp"
    CWD="/tmp"
fi
rm -f powersave_logs.tmp

pushd /var >/dev/null

tar -czf $CWD/$ARCHIVE $LOGFILES $STATEFILES >/dev/null 2>&1
popd >/dev/null
RESULT=`tar -tzf $CWD/$ARCHIVE`

if test "$RESULT" != ""; then
    echo -e "\nFile(s) saved to $CWD/$ARCHIVE:"
    for i in $RESULT; do
	echo -e "\t $LOGDIR/$i"
    done

    echo -e "--> done\n"
else
    rm $ARCHIVE
    echo -e "\nFile(s) which could not be saved:"
    for i in $LOGFILES; do
        echo -e "\t $LOGDIR/$i"
    done
    echo -e "--> failed\n"
fi