.. 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: Tests
command_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
from command_watcher import Watch
watch = Watch(
config_file='/etc/command-watcher.ini',
service_name='texlive_update'
)
tlmgr = '/usr/local/texlive/bin/x86_64-linux/tlmgr'
watch.run('{} update --self'.format(tlmgr))
watch.run('{} update --all'.format(tlmgr))
installed_packages = watch.run(
'{} info --only-installed'.format(tlmgr), log=False
)
all_packages = watch.run('{} info'.format(tlmgr), 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:: ini
[email]
subject_prefix = [cwatcher]
from_addr =
to_addr = logs@example.com
to_addr_critical = critical@example.com
smtp_login = mailer
smtp_password = 1234
smtp_server = mail.example.com:587
[nsca]
remote_host = 1.2.3.4
password = asdf1234
encryption_method = 8
; port = 5667
[icinga]
url = https://icinga.example.com:5665
user = user
password = 1234
[beep]
activated = True
Raw data
{
"_id": null,
"home_page": "https://github.com/Josef-Friedrich/command-watcher",
"name": "command_watcher",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Josef Friedrich",
"author_email": "josef@friedrich.rocks",
"download_url": "https://files.pythonhosted.org/packages/b0/14/cc051d3d6052b7aee5779e05e26f75912e8496119160936ace60d837fe4f/command_watcher-0.4.1.tar.gz",
"platform": null,
"description": ".. image:: http://img.shields.io/pypi/v/command-watcher.svg\n :target: https://pypi.org/project/command-watcher\n :alt: This package on the Python Package Index\n\n.. image:: https://github.com/Josef-Friedrich/command-watcher/actions/workflows/tests.yml/badge.svg\n :target: https://github.com/Josef-Friedrich/command-watcher/actions/workflows/tests.yml\n :alt: Tests\n\ncommand_watcher\n===============\n\nModule to watch the execution of shell scripts. Both streams (`stdout`\nand `stderr`) are captured.\n\n.. code:: python\n\n watch = Watch()\n watch.log.critical('msg')\n watch.log.error('msg')\n watch.log.warning('msg')\n watch.log.info('msg')\n watch.log.debug('msg')\n watch.run(['rsync', '-av', '/home', '/backup'])\n\n.. code-block:: python\n\n from command_watcher import Watch\n watch = Watch(\n config_file='/etc/command-watcher.ini',\n service_name='texlive_update'\n )\n\n tlmgr = '/usr/local/texlive/bin/x86_64-linux/tlmgr'\n\n watch.run('{} update --self'.format(tlmgr))\n watch.run('{} update --all'.format(tlmgr))\n installed_packages = watch.run(\n '{} info --only-installed'.format(tlmgr), log=False\n )\n all_packages = watch.run('{} info'.format(tlmgr), log=False)\n\n watch.final_report(\n status=0,\n performance_data={\n 'installed_packages': installed_packages.line_count_stdout,\n 'all_packages': all_packages.line_count_stdout,\n },\n )\n\n.. code-block:: ini\n\n [email]\n subject_prefix = [cwatcher]\n from_addr =\n to_addr = logs@example.com\n to_addr_critical = critical@example.com\n smtp_login = mailer\n smtp_password = 1234\n smtp_server = mail.example.com:587\n\n [nsca]\n remote_host = 1.2.3.4\n password = asdf1234\n encryption_method = 8\n ; port = 5667\n\n [icinga]\n url = https://icinga.example.com:5665\n user = user\n password = 1234\n\n [beep]\n activated = True\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Module to watch the execution of shell scripts. Both streams (`stdout` and `stderr`) are captured.",
"version": "0.4.1",
"project_urls": {
"Homepage": "https://github.com/Josef-Friedrich/command-watcher",
"Repository": "https://github.com/Josef-Friedrich/command-watcher"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8773ef9614aa6c3606c89e63acf608f756f7c5a34a78ba3559bb9def306ce5de",
"md5": "fa88a46357658260b1e040cb01901d64",
"sha256": "dda3f374f0c161e29be05c8f622604dcaf83f4a13066b2c56098904fd6f2158d"
},
"downloads": -1,
"filename": "command_watcher-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa88a46357658260b1e040cb01901d64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 13369,
"upload_time": "2024-02-14T21:46:18",
"upload_time_iso_8601": "2024-02-14T21:46:18.491628Z",
"url": "https://files.pythonhosted.org/packages/87/73/ef9614aa6c3606c89e63acf608f756f7c5a34a78ba3559bb9def306ce5de/command_watcher-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b014cc051d3d6052b7aee5779e05e26f75912e8496119160936ace60d837fe4f",
"md5": "d5ca853be9b66a3ca5bb6d0315805951",
"sha256": "72ef2ec832486e59874cb5fcd8131396ea76c7f2ce29ac224e580ffa6ca66eaf"
},
"downloads": -1,
"filename": "command_watcher-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "d5ca853be9b66a3ca5bb6d0315805951",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 11604,
"upload_time": "2024-02-14T21:46:24",
"upload_time_iso_8601": "2024-02-14T21:46:24.793397Z",
"url": "https://files.pythonhosted.org/packages/b0/14/cc051d3d6052b7aee5779e05e26f75912e8496119160936ace60d837fe4f/command_watcher-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-14 21:46:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Josef-Friedrich",
"github_project": "command-watcher",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "command_watcher"
}