Advertisement
kiler129

vprocunhide

Jul 1st, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.55 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # vprocunhide  sets vserver related attributes for /proc
  4. #
  5. # chkconfig: 2345 26 74
  6. # description: Makes some /proc entries visibly for vservers
  7. #
  8. ### BEGIN INIT INFO
  9. # Provides:          vprocunhide
  10. # Required-Start:    $remote_fs $syslog $time
  11. # Required-Stop:     $remote_fs $syslog $time
  12. # Default-Start:     2 3 4 5
  13. # Default-Stop:      0 1 6
  14. # Short-Description: vprocunhide  sets vserver related attributes for /proc
  15. # Description:       vprocunhide  sets vserver related attributes for /proc.
  16. ### END INIT INFO
  17.  
  18. : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
  19. test -e "$UTIL_VSERVER_VARS" || {
  20.     echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
  21.     exit 1
  22. }
  23. . "$UTIL_VSERVER_VARS"
  24.  
  25. $_VSERVER_INFO - FEATURE iattr || exit 0
  26.  
  27. LOCKFILE=vprocunhide
  28. . "$_LIB_VSERVER_INIT_FUNCTIONS"
  29.  
  30.  
  31. function start()
  32. {
  33.     _beginResult $"Fixing /proc entries visibility"
  34.     $_VPROCUNHIDE
  35.     _endResult $?
  36.     local retval=$?
  37.     test "$retval" -ne 0 || touch "$lockfile"
  38.     return $retval
  39. }
  40.  
  41. function stop()
  42. {
  43.     $_RM -f "$lockfile"
  44. }
  45.  
  46. function restart()
  47. {
  48.     stop
  49.     start
  50. }
  51.  
  52. case "$1" in
  53.     start|stop|restart) $1;;
  54.     reload)     ;;
  55.     condrestart)
  56.     test -f $lockfile && restart || :
  57.     ;;
  58.     status)
  59.     test -f $lockfile && {
  60.         echo $"/proc entries were fixed"
  61.         exit 0
  62.     }
  63.     echo $"/proc entries are not fixed"
  64.     exit 1
  65.     ;;
  66.     *)
  67.         echo "Usage: $0 {start|stop|reload|restart|condrestart|status}"
  68.     exit 2
  69.     ;;
  70. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement