1
0

lvm-monitoring.initd-r3 960 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2019 Gentoo Authors
  3. # Distributed under the terms of the GNU General Public License v2
  4. # This script is based on upstream file
  5. # LVM2.2.02.67/scripts/lvm2_monitoring_init_red_hat.in
  6. depend() {
  7. # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that
  8. # means dmeventd is NOT notified, as it cannot be safely running
  9. need lvm dmeventd
  10. }
  11. VGCHANGE=/sbin/vgchange
  12. VGS=/sbin/vgs
  13. start() {
  14. ret=0
  15. # TODO do we want to separate out already active groups only?
  16. VGSLIST=`$VGS --noheadings -o name --rows 2> /dev/null`
  17. ebegin "Starting LVM monitoring for VGs ${VGSLIST}:"
  18. $VGCHANGE --monitor y --poll y ${VGSLIST}
  19. ret=$?
  20. eend $ret
  21. return $ret
  22. }
  23. stop() {
  24. ret=0
  25. # TODO do we want to separate out already active groups only?
  26. VGSLIST=`$VGS --noheadings -o name --rows 2> /dev/null`
  27. ebegin "Stopping LVM monitoring for VGs ${VGSLIST}:"
  28. $VGCHANGE --monitor n ${VGSLIST}
  29. ret=$?
  30. eend $ret
  31. return $ret
  32. }