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.4.1.tar.gz
(11.6 kB
view hashes)
Built Distribution
Close
Hashes for command_watcher-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda3f374f0c161e29be05c8f622604dcaf83f4a13066b2c56098904fd6f2158d |
|
MD5 | fa88a46357658260b1e040cb01901d64 |
|
BLAKE2b-256 | 8773ef9614aa6c3606c89e63acf608f756f7c5a34a78ba3559bb9def306ce5de |