Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

debian auto-update system

By: a guest on Jul 22nd, 2013  |  syntax: Bash  |  size: 1.33 KB  |  views: 62  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. LOGFILE=~/logs/apt-log.log
  3. APTLOG=~/logs/apt-upgrade.log
  4. TMPLOG=~/logs/tmp1.log
  5. TMPLOG2=~/logs/tmp22.log
  6. DATEFMT=%X:%x
  7. SHNAME=`basename $0`
  8. SLEEP=5m        #wait till box is presumably less-loaded
  9.  
  10. echo -e "$SHNAME start sleep $SLEEP \t"`date +$DATEFMT` > $TMPLOG2;
  11. cat $LOGFILE >> $TMPLOG2;
  12. mv $TMPLOG2 $LOGFILE;
  13. sleep $SLEEP;
  14.  
  15. sudo apt-key update;
  16.  
  17. sudo apt-get autoclean; echo -e "$SHNAME autoclean \t\t"`date +$DATEFMT` > $TMPLOG2;
  18. cat $LOGFILE >> $TMPLOG2;
  19. mv $TMPLOG2 $LOGFILE;
  20.  
  21. sudo apt-get autoremove -y; echo -e "$SHNAME autoremove \t\t"`date +$DATEFMT` > $TMPLOG2;
  22. cat $LOGFILE >> $TMPLOG2;
  23. mv $TMPLOG2 $LOGFILE;
  24.  
  25. sudo apt-get update; echo -e "$SHNAME update \t\t"`date +$DATEFMT` > $TMPLOG2;
  26. cat $LOGFILE >> $TMPLOG2;
  27. mv $TMPLOG2 $LOGFILE;
  28.  
  29. echo -e "\n::: "`date +$DATEFMT`" :::" > $TMPLOG;
  30. sudo apt-get upgrade -yq >> $TMPLOG;
  31. cat $APTLOG >> $TMPLOG;
  32. mv $TMPLOG $APTLOG;
  33.  
  34. #echo -e "$SHNAME dist-upgrade \t\t"`date +$DATEFMT` > $TMPLOG2;
  35. #sudo apt-get dist-upgrade -yq >> $TMPLOG;
  36. #cat $LOGFILE >> $TMPLOG2;
  37. #mv $TMPLOG2 $LOGFILE;
  38.  
  39. sudo apt-get clean -y; echo -e "$SHNAME clean \t\t\t"`date +$DATEFMT` > $TMPLOG2;
  40. cat $LOGFILE >> $TMPLOG2;
  41. mv $TMPLOG2 $LOGFILE;
  42.  
  43. sudo msfupdate; echo -e "$SHNAME msfupdate \t\t"`date +$DATEFMT` > $TMPLOG2;
  44. cat $LOGFILE >> $TMPLOG2;
  45. mv $TMPLOG2 $LOGFILE;
  46.  
  47. exit 0