51g15hook.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # g15daemon hook script for pm-utils.
  3. # If you use g15daemon in conjunction with pm-utils, this hook script
  4. # stops g15daemon when suspending/hinernating and restarts it when
  5. # resuming/thawing.
  6. # Copyright (c) 2011 Alan Alberghini <414N@slacky.it>
  7. # All rights reserved.
  8. #
  9. # Permission to use, copy, modify, and distribute this software for
  10. # any purpose with or without fee is hereby granted, provided that
  11. # the above copyright notice and this permission notice appear in all
  12. # copies.
  13. #
  14. # THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESSED OR IMPLIED
  15. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  17. # IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  18. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  20. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  23. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  24. # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25. # SUCH DAMAGE.
  26. if [ -x /etc/rc.d/rc.g15daemon ]
  27. then
  28. case $1 in
  29. resume|thaw)
  30. /etc/rc.d/rc.g15daemon restart
  31. ;;
  32. hibernate)
  33. /etc/rc.d/rc.g15daemon stop
  34. ;;
  35. esac
  36. fi