Module to watch the execution of shell scripts. Both streams (`stdout` and `stderr`) are captured.
Project description
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'])
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,
},
)
[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
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
command_watcher-0.5.0.tar.gz
(11.4 kB
view details)
Built Distribution
File details
Details for the file command_watcher-0.5.0.tar.gz
.
File metadata
- Download URL: command_watcher-0.5.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0c16275b905e024e8555e4ef87aab2d57e2dd3e880110bcd9e46438fb1ad5a2 |
|
MD5 | bed90d268d6cb8eef9065bc9528d4c83 |
|
BLAKE2b-256 | 35c2894533fae7dfedadf73024d29abce09ea8ed0ab8b5681d4316bbfa6e7b7f |
File details
Details for the file command_watcher-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: command_watcher-0.5.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4d86ff9f9ae7c877e2667c04fcc172f6a36af3a9d07694011cf1ee545230e2b |
|
MD5 | 60eb8a7564fd2da6243c2039360faaf5 |
|
BLAKE2b-256 | 7fa9314cdd21bf0da9b9858e59d1d89f7565fddfe0855d903f2dd7bedbc660cc |