-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrescue
executable file
·65 lines (48 loc) · 1.21 KB
/
rescue
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
60
61
62
63
64
65
#!/bin/bash
#
# Get logs and restart X good for AMD crappy fglrx drivers.
# Author: Artur O. [email protected] (Justice @ Freenode #Archlinux)
# Config
path="/var/log"
destination=~/"rescue"
# Dateformat
date=$(date +[%F-%a]%H:%M)
echo "Date: $date "
# Ask for userinput, Nn [enter] will be false
asksure(){
read -p "Want to kill Xorg & Restart KDM? [y/N] " -n 1 choice
case "$choice" in
Y|y ) return 0;;
N|n ) return 1;;
* ) return 1;;
esac
}
if [[ -d "$destination" ]]; then
echo "Folder exists in ["$destination"] "
else
echo "Folder does not exist, creating folder ["$destination"] "
mkdir "$destination"
fi
echo ""
echo "Saving $path/Xorg.0.log..."
cat "$path"/Xorg.0.log > "$destination"/Xorg.0.log"$date"
echo "Saving $path/Xorg.0.log.old..."
cat "$path"/Xorg.0.log > "$destination"/Xorg.0.log.old"$date"
echo "Saving dmesg..."
dmesg > "$destination"/dmesg.log"$date"
echo "Saving kernel.log..."
sudo cat "$path"/kernel.log > "$destination"/kernel.logs"$date"
echo ""
if asksure; then
echo ""
echo "[1/2] Killing KDM..."
sudo systemctl kill kdm
echo ""
echo "[2/2] Booting up KDM..."
sleep 2
sudo systemctl start kdm
else
echo ""
exit 0
fi
exit 0