A wrapper script for Borg backup software that creates and prunes backups
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

signals.py 628B

  1. import os
  2. import signal
  3. def _handle_signal(signal_number, frame): # pragma: no cover
  4. '''
  5. Send the signal to all processes in borgmatic's process group, which includes child process.
  6. '''
  7. os.killpg(os.getpgrp(), signal_number)
  8. def configure_signals(): # pragma: no cover
  9. '''
  10. Configure borgmatic's signal handlers to pass relevant signals through to any child processes
  11. like Borg. Note that SIGINT gets passed through even without these changes.
  12. '''
  13. for signal_number in (signal.SIGHUP, signal.SIGTERM, signal.SIGUSR1, signal.SIGUSR2):
  14. signal.signal(signal_number, _handle_signal)