Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F4638477
pacemaker-cts-dummyd.in
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
pacemaker-cts-dummyd.in
View Options
#!@PYTHON@
""" Slow-starting idle daemon that notifies systemd when it starts
"""
# Pacemaker targets compatibility with Python 2.7 and 3.2+
from __future__ import print_function, unicode_literals, absolute_import, division
__copyright__ = "Copyright 2014-2018 Andrew Beekhof <andrew@beekhof.net>"
__license__ = "GNU General Public License version 2 or later (GPLv2+) WITHOUT ANY WARRANTY"
import sys
import time
import signal
import subprocess
have_systemd_daemon = True
try:
import systemd.daemon
except ImportError:
have_systemd_daemon = False
delay = None
def parse_args():
global delay
# Lone argument is a number of seconds to delay start and stop
if len(sys.argv) > 0:
try:
delay = float(sys.argv[1])
except ValueError:
delay = None
def twiddle():
global delay
if delay is not None:
time.sleep(delay)
def bye(signum, frame):
twiddle()
sys.exit(0)
if __name__ == "__main__":
parse_args()
signal.signal(signal.SIGTERM, bye)
twiddle()
if have_systemd_daemon:
systemd.daemon.notify("READY=1")
else:
subprocess.call(["systemd-notify", "READY=1"])
# This isn't a "proper" daemon, but that would be overkill for testing purposes
while True:
time.sleep(600.0)
File Metadata
Details
Attached
Mime Type
text/x-script.python
Expires
Thu, Jul 10, 12:35 AM (5 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1980852
Default Alt Text
pacemaker-cts-dummyd.in (1 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment