Skip to main content
This package on the Python Package Index Tests

command_watcher

Module to watch the execution of shell scripts. Both streams (stdout and stderr) are captured.

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'])
#! /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,
    },
)
---
email:
    from_addr: logs@example.com
    to_addr: logs@example.com
    to_addr_critical: critical@example.com
    smtp_login: mailer@mail.example.com
    smtp_password: abcd
    smtp_server: mail.example.com:587

icinga:
    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: monthly

beep:
    activated: true

Download files

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

Source Distribution

command_watcher-0.6.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

command_watcher-0.6.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file command_watcher-0.6.0.tar.gz.

File metadata

  • Download URL: command_watcher-0.6.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for command_watcher-0.6.0.tar.gz
Algorithm Hash digest
SHA256 82dc563a6fe9d14d8201f4ff998c536e7bdf596f48dee5e79f819cd9afbf4c7b
MD5 b52a5a8d68bfe7e3bd782c197e0cdd64
BLAKE2b-256 a25369c0688cddb878c8b9af8f2f473ff1f12062d88b3863a93e928306e7ccb8

See more details on using hashes here.

File details

Details for the file command_watcher-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: command_watcher-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for command_watcher-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 562945564e1fa2b87d7cc828718d9ac716d869baf2210f58ae524d1f3d41c827
MD5 b5fca413dc3bd8100bec7236f2438aee
BLAKE2b-256 acff0cbd7d810b90fcf283c6ad879539615ed2700c52d27f55df21425062d0a9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

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