daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Sep 17th, 2012 14 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. set -e
  4.  
  5. [ -x /usr/bin/updatedb.mlocate ] || exit 0
  6.  
  7. if which on_ac_power >/dev/null 2>&1; then
  8.     ON_BATTERY=0
  9.     on_ac_power >/dev/null 2>&1 || ON_BATTERY=$?
  10.     if [ "$ON_BATTERY" -eq 1 ]; then
  11.         exit 0
  12.     fi
  13. fi
  14.  
  15. ##
  16.  
  17. LOCKFILE="/var/lib/mlocate/daily.lock"
  18.  
  19. trap "rm -f $LOCKFILE" EXIT
  20.  
  21. if [ -e "$LOCKFILE" ]; then
  22.     echo >&2 "Warning: $LOCKFILE present, not running updatedb."
  23.     exit 1
  24. else
  25.     touch "$LOCKFILE"
  26. fi
  27.  
  28. ##
  29.  
  30. # See ionice(1)
  31. if [ -x /usr/bin/ionice ] &&
  32.     /usr/bin/ionice -c3 true 2>/dev/null; then
  33.     IONICE="/usr/bin/ionice -c3"
  34. fi
  35.  
  36. $IONICE /usr/bin/updatedb.mlocate
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top