Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josef-friedrich/command-watcher
Module to watch the execution of shell scripts. Both streams (stdout and stderr) are captured.
https://github.com/josef-friedrich/command-watcher
Last synced: about 1 month ago
JSON representation
Module to watch the execution of shell scripts. Both streams (stdout and stderr) are captured.
- Host: GitHub
- URL: https://github.com/josef-friedrich/command-watcher
- Owner: Josef-Friedrich
- License: mit
- Created: 2022-07-13T18:30:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T21:45:38.000Z (11 months ago)
- Last Synced: 2024-03-15T13:07:34.885Z (10 months ago)
- Language: Python
- Homepage: https://pypi.org/project/command-watcher/
- Size: 241 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
.. image:: http://img.shields.io/pypi/v/command-watcher.svg
:target: https://pypi.org/project/command-watcher
:alt: This package on the Python Package Index.. image:: https://github.com/Josef-Friedrich/command-watcher/actions/workflows/tests.yml/badge.svg
:target: https://github.com/Josef-Friedrich/command-watcher/actions/workflows/tests.yml
:alt: Testscommand_watcher
===============Module to watch the execution of shell scripts. Both streams (`stdout`
and `stderr`) are captured... code:: python
watch = Watch()
watch.log.critical('msg')
watch.log.error('msg')
watch.log.warning('msg')
watch.log.info('msg')
watch.log.debug('msg')
watch.run(['rsync', '-av', '/home', '/backup']).. code-block:: python
#! /opt/venvs/command_watcher/bin/python
from command_watcher import Watch
watch = Watch(
config_file='/etc/command-watcher.yml',
service_name='texlive_update'
)tlmgr = '/usr/local/texlive/bin/x86_64-linux/tlmgr'
watch.run(f'{tlmgr} update --self')
watch.run(f'{tlmgr} update --all')
installed_packages = watch.run(
f'{tlmgr} info --only-installed', log=False
)
all_packages = watch.run(f'{tlmgr} info', log=False)watch.final_report(
status=0,
performance_data={
'installed_packages': installed_packages.line_count_stdout,
'all_packages': all_packages.line_count_stdout,
},
).. code-block:: yaml
---
email:
from_addr: [email protected]
to_addr: [email protected]
to_addr_critical: [email protected]
smtp_login: [email protected]
smtp_password: abcd
smtp_server: mail.example.com:587icinga:
api_endpoint_host: localhost
api_endpoint_port: 5665
client_private_key: /etc/pretiac/api-client.key.pem
client_certificate: /etc/pretiac/api-client.cert.pem
ca_certificate: /etc/pretiac/ca.crt
new_host_defaults:
templates: [passive-host]
new_service_defaults:
templates: [passive-service]
attrs:
check_interval: monthlybeep:
activated: true