module cli.script_exec
¶
Short summary¶
module pyquickhelper.cli.script_exec
Repeat execution.
Functions¶
function |
truncated documentation |
---|---|
Runs a python script on a regular basis. The function is not multithreaded, it returns when all execution are done. … |
Documentation¶
Repeat execution.
- pyquickhelper.cli.script_exec.repeat_script(script, every_second=20, stop_after_second=-1, outfile='out.log', errfile='err.log', exc=True, verbose=1, fLOG=<built-in function print>)[source]¶
Runs a python script on a regular basis. The function is not multithreaded, it returns when all execution are done.
- Parameters:
script – script to run
every_second – every second
stop_after_second – stop after a given time or never if -1
outfile – file which receives the standard output
errfile – file which receives the standard error
exc – True to stop if an exception is raised, False to continue
verbose – prints out every execution
fLOG – logging function
Repeat script execution every n seconds
The command line runs the execution a script on a regular basis.
<<<
python -m pyquickhelper repeat_script --help
>>>
usage: repeat_script [-h] [-s SCRIPT] [-e EVERY_SECOND] [-st STOP_AFTER_SECOND] [-o OUTFILE] [-er ERRFILE] [--exc EXC] [-v VERBOSE] Runs a python script on a regular basis. The function is not multithreaded, it returns when all execution are done. optional arguments: -h, --help show this help message and exit -s SCRIPT, --script SCRIPT script to run (default: None) -e EVERY_SECOND, --every_second EVERY_SECOND every second (default: 20) -st STOP_AFTER_SECOND, --stop_after_second STOP_AFTER_SECOND stop after a given time or never if -1 (default: -1) -o OUTFILE, --outfile OUTFILE file which receives the standard output (default: out.log) -er ERRFILE, --errfile ERRFILE file which receives the standard error (default: err.log) --exc EXC True to stop if an exception is raised, False to continue (default: True) -v VERBOSE, --verbose VERBOSE prints out every execution (default: 1)