Creating Daemon processΒΆ

☯️ daemonpy is package for creating Daemon processes.

Developed in 🐍 python code.

codecov circleci

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.

python checker python package github issues documentation status github contributors

InstallationΒΆ

install python2 package install python3 package

ubuntu linux os

Navigate to release page download and extract release archive πŸ“¦.

To install daemonpy πŸ“¦ run

tar xvzf daemonpy-x.y.z.tar.gz
cd daemonpy-x.y.z
# python2
pip install -r requirements.txt
python -m build
pip install dist/daemonpy-x.y.z-py2-none-any.whl
# python3
pip3 install -r requirements.txt
python3 -m build
pip3 install dist/daemonpy-x.y.z-py3-none-any.whl

Or type the following

tar xvzf daemonpy-x.y.z.tar.gz
cd daemonpy-x.y.z/
# python2
pip install -r requirements.txt
python setup.py install_lib
python setup.py install_egg_info
# pyton3
pip3 install -r requirements.txt
python3 setup.py install_lib
python3 setup.py install_egg_info

You can use Docker to create image/container, or You can use pip to install πŸ“¦

# python2
pip install daemonpy
# python3
pip3 install daemonpy

github docker checker

UsageΒΆ

Create short example

#!/usr/bin/env python

'''
 Module
     mydaemon.py
 Copyright
     Copyright (C) 2020 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
     Defined 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):
    '''
        Defined 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ΒΆ

daemonpy requires next 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
└── unix_operations.py

Indices and tablesΒΆ