Skip to content

Instantly share code, notes, and snippets.

@mabnhdev
Created April 6, 2017 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mabnhdev/121154d3c6fd830d60a60eaee3c33c7b to your computer and use it in GitHub Desktop.
Save mabnhdev/121154d3c6fd830d60a60eaee3c33c7b to your computer and use it in GitHub Desktop.
Snappy python daemon problem.
snapcraft.yaml:
name: test
version: '0.1'
summary: Test snappy daemonization
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel
confinement: devmode
apps:
test-daemon:
command: usr/bin/test-daemon
daemon: forking
parts:
tests:
plugin: dump
stage-packages:
- python-daemon
source: src/tests
test-daemon:
#!/usr/bin/env python
import daemon
import syslog
import time
def main():
id = 0
while True:
id = id + 1
syslog.syslog(syslog.LOG_INFO, 'id={} hello {}!!!!'.format(id, 'world'))
time.sleep(60)
with daemon.DaemonContext():
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment