Skip to main content

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.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.6.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

repeatexec-0.0.6-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file repeatexec-0.0.6.tar.gz.

File metadata

  • Download URL: repeatexec-0.0.6.tar.gz
  • Upload date:
  • Size: 2.2 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

Hashes for repeatexec-0.0.6.tar.gz
Algorithm Hash digest
SHA256 83cb193ac170ca233f4ff8ba417adb1f1204590f40bb6e363759b8655b0493bb
MD5 d6e89d0e782df211fb58eab625f1699b
BLAKE2b-256 26fe7c080e5e209744118223b6eb50819efb8457947ff768b2cf4d911601a5b4

See more details on using hashes here.

File details

Details for the file repeatexec-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: repeatexec-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.3 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

Hashes for repeatexec-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 768f3c3fbbe9628383291143b89a0e5599541e674ca978be77826d602edeffb1
MD5 9559144a644fdd29dbdb68acb6eada50
BLAKE2b-256 98cc1b84c0a7915ade2680e16a0ea8552043a87da10c81fa42596ac7a86c5c89

See more details on using hashes here.

Supported by

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