Created
October 9, 2016 17:12
-
-
Save quasoft/0143656abc445b4ea1b839c8b2fa264c to your computer and use it in GitHub Desktop.
Example on using daemonize module in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
import time | |
from daemonize import Daemonize | |
def main(): | |
while True: | |
time.sleep(10) | |
if __name__ == '__main__': | |
appname=os.path.basename(sys.argv[0]) | |
pidfile='/tmp/mypidfile.pid' | |
daemon = Daemonize(app=appname,pid=pidfile, action=main) | |
daemon.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment