A command line tool for running a command repeatedly
Project description
repeatexec
Description
run a command repeatedly.
repeatexec -n 10 -e ls
run ls every 10 seconds
changes
0.0.7
when there are untract files, isgitdirty return true.
def is_git_dirty():
if has_change() or has_untracted_files():
sys.exit(0)
else:
sys.exit(1)
0.0.6
add command isgitdirty to check if current git repo is dirty.
isgitdirty && echo dirty
The implementation is very simple:
import sys
import subprocess
def is_git_dirty():
result = subprocess.run(('git', 'diff', '--name-only'), capture_output=True)
if result.stdout != b'':
sys.exit(0)
else:
sys.exit(1)
0.0.5
print current timestamp before running command
def repeate_exec():
if not option_check():
return
sec_i = sys.argv.index('-n') + 1
cmd_i = sys.argv.index('-e') + 1
sleep_seconds = int(sys.argv[sec_i])
command = sys.argv[cmd_i:]
command = ' '.join(command)
print('commands:', command)
print(f'interval: {sleep_seconds}s')
while True:
ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f'----------------------------------------------------------------')
print(f' {ts} ')
print(f'----------------------------------------------------------------')
run_command(command)
time.sleep(sleep_seconds)
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
repeatexec-0.0.7.tar.gz
(2.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repeatexec-0.0.7.tar.gz.
File metadata
- Download URL: repeatexec-0.0.7.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5574164f485173935374974d19bcf5fb7c7b834667816b574a5ce4a59d81a27
|
|
| MD5 |
673a0f99ccebe38cf9e7e7bb80c99ef4
|
|
| BLAKE2b-256 |
eaaf199e5175a440c93ab2b5499bcf86359f88ad947c320bf09e8f4a088021c9
|
File details
Details for the file repeatexec-0.0.7-py3-none-any.whl.
File metadata
- Download URL: repeatexec-0.0.7-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
563d4737f0c669e955d969de796435c4b5b6c50c8442b62c90684f19b458d6b6
|
|
| MD5 |
664268462a92ad96b40deb118da42b3a
|
|
| BLAKE2b-256 |
24f1f8b39aa00e653156a4ac195826974330bdaa007d43c3cd0eb0e7842836e9
|