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 - 2024 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

Docs

Documentation Status

More documentation and info at

Contributing

Contributing to daemonpy

Copyright and licence

License: GPL v3 License

Copyright (C) 2020 - 2024 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.5.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

daemonpy-2.0.5-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for daemonpy-2.0.5.tar.gz
Algorithm Hash digest
SHA256 f5cc51a9572e4b1bb49cf7b2bdea18d1fb7488b067285a8a39e95fcbee8a0f9a
MD5 7e7d69c7062a75aa7abf5e4ed4ca9219
BLAKE2b-256 99dac21e293176053af0ef6ceeb7ad38323c06ec358b2b03c8ab72094d58eabf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for daemonpy-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0aa8db1067bacd18ebc167c5a36a0ed2493e2889b2d023fd355790b15537369c
MD5 7dbc077b1e8ee819a2d47457c94f85ad
BLAKE2b-256 5295e5c29865e8861713028b017cc3c81e09ef7506dd23ecfd899be589c98b52

See more details on using hashes here.

Supported by

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