Skip to main content

Creating Daemon process

Project description

Creating Daemon process

daemonpy is package for creating Daemon processes.

Developed in python code: 100%.

The README is used to introduce the modules and provide instructions on how to install the modules, any machine dependencies it may have and any other information that should be provided before the modules are installed.

daemonpy python checker daemonpy package checker GitHub issues open GitHub contributors

Table of Contents

Installation

Used next development environment

debian linux os

daemonpy python3 build

Currently there are three ways to install package

  • Install process based on using pip mechanism
  • Install process based on build mechanism
  • Install process based on setup.py mechanism
  • Install process based on docker mechanism
Install using pip

Python package is located at pypi.org.

You can install by using pip

# python3
pip3 install daemonpy
Install using build

Navigate to release page download and extract release archive.

To install daemonpy type the following

tar xvzf daemonpy-x.y.z.tar.gz
cd daemonpy-x.y.z
# python3
pip3 install -r requirements.txt
python3 -m build
pip3 install dist/daemonpy-x.y.z-py3-none-any.whl
Install using py setup

Navigate to release page download and extract release archive.

To install daemonpy, locate and run setup.py with arguments

tar xvzf daemonpy-x.y.z.tar.gz
cd daemonpy-x.y.z
# python3
pip3 install -r requirements.txt
python3 setup.py install_lib
python3 setup.py install_egg_info
Install using docker

You can use Dockerfile to create image/container.

Usage

Create short example

#!/usr/bin/env python

'''
 Module
     mydaemon.py
 Copyright
     Copyright (C) 2020 - 2026 Vladimir Roncevic <elektron.ronca@gmail.com>
     mydaemon is free software: you can redistribute it and/or modify it
     under the terms of the GNU General Public License as published by the
     Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
     mydaemon is distributed in the hope that it will be useful, but
     WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     See the GNU General Public License for more details.
     You should have received a copy of the GNU General Public License along
     with this program. If not, see <http://www.gnu.org/licenses/>.
 Info
     Defines class MyDaemon with attribute(s) and method(s).
     Set an operation for Daemon process.
'''

import sys
from time import sleep

try:
    from daemonpy import Daemon
except ImportError as ats_error:
    MESSAGE = '\n{0}\n{1}\n'.format(__file__, ats_error)
    sys.exit(MESSAGE)  # Force close python ATS ##############################


class MyDaemon(Daemon):
    '''
        Defines class MyDaemon with attribute(s) and method(s).
        Set an operation for Daemon process.
        It defines:

            :attributes:
                | None
            :methods:
                | run - run Daemon process (defined method).
    '''

    def run(self):
        '''
            Run Daemon process with time sleep example.

            :exceptions: None
        '''
        while True:
            sleep(1)

if __name__ == '__main__':
    DAEMON = MyDaemon('/tmp/daemon-example.pid')
    DAEMON.usage(sys.argv[1])

Dependencies

These modules requires other modules and libraries

Package structure

daemonpy is based on OOP.

Package structure

    daemonpy/
       ├── daemon_usage.py
       ├── file_descriptor.py
       ├── file_process_id.py
       ├── __init__.py
       ├── py.typed
       └── unix_operations.py
    
    1 directory, 6 files

Code coverage

Name Stmts Miss Cover
daemonpy/__init__.py 135 79 41%
daemonpy/daemon_usage.py 45 2 96%
daemonpy/file_descriptor.py 47 4 91%
daemonpy/file_process_id.py 39 0 100%
daemonpy/unix_operations.py 72 35 51%
Total 338 120 64%

Docs

Documentation Status

More documentation and info at

Contributing

Contributing to daemonpy

Copyright and licence

License: GPL v3 License

Copyright (C) 2020 - 2026 by vroncevic.github.io/daemonpy

daemonpy is free software; you can redistribute it and/or modify it under the same terms as Python itself, either Python version 2.x/3.x or, at your option, any later version of Python 3 you may have available.

Lets help and support PSF.

Python Software Foundation

Donate

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

daemonpy-2.0.7.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daemonpy-2.0.7-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file daemonpy-2.0.7.tar.gz.

File metadata

  • Download URL: daemonpy-2.0.7.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.12.3

File hashes

Hashes for daemonpy-2.0.7.tar.gz
Algorithm Hash digest
SHA256 e4eeb65cef624f74fa59b83f986e77b698b8aab800b2959555e1d31ed850078d
MD5 8bc43c35e6321bef467c718feedb8d37
BLAKE2b-256 139854b97f22f36e911b066c4c52fdb7f3b7060cfd241c58413e33ce12c4859b

See more details on using hashes here.

File details

Details for the file daemonpy-2.0.7-py3-none-any.whl.

File metadata

  • Download URL: daemonpy-2.0.7-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.0 CPython/3.12.3

File hashes

Hashes for daemonpy-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7517928b65ab74e7f83d474abb645d7fac00d038f7e1e906a2eecbe09580aa78
MD5 72f03f9c8df89705a9d6206533c2bd09
BLAKE2b-256 97d8e503bc829c93c63218f01612a7e5759dbcb6e5dac873f18c26f920bacf15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page