summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/__main__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/__main__.py b/src/__main__.py
index 881b3c1..03d99b8 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -15,7 +15,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
+import sys
import time
+import signal
import datetime
from colour import *
@@ -147,6 +149,16 @@ if periodically is not None:
wd = t.isocalendar()[2]
periodically(t.year, t.month, t.day, t.hour, t.minute, t.second, wd, fade)
+ ## Catch TERM signal
+ def signal_SIGTERM(signum, frame):
+ if not running:
+ running = False
+ start_over()
+ monitor_controller()
+ sys.exit(0)
+ running = False
+ signal.signal(signal.SIGTERM, signal_SIGTERM)
+
## Fade in
early_exit = False
ftime = 0