Created
April 6, 2017 17:46
-
-
Save mabnhdev/17a8cb7bdc4df947a1c24d42c32b1daf to your computer and use it in GitHub Desktop.
Python notify daemon in snappy.
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
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: notify | |
parts: | |
tests: | |
plugin: dump | |
stage-packages: | |
- python-daemon | |
- python-systemd | |
source: src/tests | |
src/tests/usr/bin/test-daemon: | |
#!/usr/bin/env python | |
import daemon | |
import syslog | |
import time | |
from systemd.daemon import notify | |
def main(): | |
notify('READY=1') | |
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