|
@@ -29,7 +29,6 @@ import sys
|
|
|
import os
|
|
|
import smtplib
|
|
|
import subprocess
|
|
|
-import signal
|
|
|
import socket
|
|
|
from email.mime.multipart import MIMEMultipart
|
|
|
from email.mime.text import MIMEText
|
|
@@ -43,21 +42,7 @@ from lib_stov import helpers
|
|
|
|
|
|
|
|
|
helpers.initialize_gettext()
|
|
|
-# Define a handler for signals sent to the program
|
|
|
-
|
|
|
-
|
|
|
-def sighandler(signum, frame):
|
|
|
- """Handler function for signals caught by stov."""
|
|
|
- if signum == 2:
|
|
|
- print(_("STRG+C has been pressed, quitting..."), file=sys.stderr)
|
|
|
- elif signum == 15:
|
|
|
- print(_("Received SIGTERM, quitting..."), file=sys.stderr)
|
|
|
- os.killpg(os.getpid(), 1)
|
|
|
- os.remove("/tmp/stov.lock")
|
|
|
- sys.exit(0)
|
|
|
-
|
|
|
-signal.signal(signal.SIGTERM, sighandler)
|
|
|
-signal.signal(signal.SIGINT, sighandler)
|
|
|
+helpers.setup_sighandler()
|
|
|
|
|
|
# Overwrite the default OptionParser class so error messages
|
|
|
# can be localized
|