daily pastebin goal
26%
SHARE
TWEET

logs

thebunnyrules May 17th, 2015 (edited) 340 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # The Lazy penGUIN's Log Collector
  2. # =====================================================
  3. # Fill out the variables below (back_dir and user_name)
  4. # Place this in your "/root" directory.
  5. # When you have issues and need to save your logs:
  6. # ctrl-alt-f2, login:root / pw:*****
  7. # > ./logs.sh
  8.  
  9.  
  10. #! /bin/sh
  11. set -e
  12.  
  13. # Varibles:
  14. # =====================
  15. backup_dir=/home/buckDOEkit                             # <=== where do you want to store the logs
  16. user_name=lapinot                               # <=== your user name here, the one you login with, not root
  17. # =====================
  18. home_dir=/home/$user_name
  19. datestamp=$(date +"%Y-%d-%m_%H-%M-%S")
  20.  
  21. mkdir $backup_dir/logs-$datestamp
  22. cp $home_dir/.xsession-errors $backup_dir/logs-$datestamp
  23. cp $home_dir/.xsession-errors.old $backup_dir/logs-$datestamp
  24. cp /var/log/Xorg.0.log $backup_dir/logs-$datestamp
  25. cp /var/log/Xorg.0.log.old $backup_dir/logs-$datestamp
  26. cp /var/log/lightdm/lightdm.log $backup_dir/logs-$datestamp
  27. cp /var/log/lightdm/x-0-greeter.log $backup_dir/logs-$datestamp
  28.  
  29. journalctl -b -0 > $backup_dir/logs-$datestamp/journal
  30. journalctl -b -1 > $backup_dir/logs-$datestamp/journal.last
  31. journalctl -b -2 > $backup_dir/logs-$datestamp/journal.2last
  32.  
  33. chmod -R a+rw $backup_dir/logs-$datestamp
  34. tar -czf $backup_dir/logs-$datestamp.tar --directory=$backup_dir logs-$datestamp
  35.  
  36.  
  37.  
  38. chmod -R a+rw $backup_dir/logs-$datestamp.tar
  39. # rm -r $backup_dir/logs-$datestamp
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand