Search

Lib.rs

› Configuration
#lock-files #command-executor #config-file #state #service #long-running

app lockex

simple command executor with locking and state

Owned by MicroPanda123.

  • Install
  • Repository (codeberg.org)

2 releases

Uses new Rust 2024

0.1.1 Oct 24, 2025
0.1.0 Oct 24, 2025

#1138 in Configuration

Custom license

10KB
201 lines

Lockex

Simple utility to help with running long-running processes cyclically.

Usage

By default lockex will read lockex.toml file inside current directory. (v0.1.1 update: now you can specify custom config file)

Format:

# Optional path to created lock path, by default '.lockex_lock'
lock_path = "something.lock"
# Optional path to created state path, by default '.lockex_state'
state = "something.state"

# Each executed command is a separate [[commands]] block
[[commands]]
# Required name of ran service
name = "cmd_name"
# Required command that's executed
command = "my_program --parameters"
# Optional time in seconds, when specified,
# lockex will keep last execution time of a command in state file
# and check if given interval passed between executions,
# will skip if less time passed
min_interval = 3600

lockex has 2 commands: run and dry-run, both will:

  • check if lock file exists
    • if exists, returns 1 and shows error, skipping execution
    • if does not exist, acquires it
  • for each command in config file it will:
    • check if it should be ran based on the state file and min_interval:
      • if previous execution happened in shorter amount of time than min_interval, it will skip this command and show message
      • otherwise, it will print the command and either execute it or skip, if in dry-run
  • lastly, it will save the execution time of each command in state file, and then release the lock file

Todo:

  • Maybe asynchronous execution of each command? As currently it runs each command one-by-one
  • Idk depends what I will need

Dependencies

~1.3–2MB
~40K SLoC

  • clap+derive
  • serde+derive
  • toml 0.9
See also: spyrun, bender, cargo-lock, docker-wrapper, bashtestmd, turul-mcp-task-storage, ava-agent, hot_reload, rc_conf, cargo-lockdiff, command-executor

Lib.rs is an unofficial list of Rust/Cargo crates, created by kornelski. It contains data from multiple sources, including heuristics, and manually curated data. Content of this page is not necessarily endorsed by the authors of the crate. This site is not affiliated with nor endorsed by the Rust Project. If something is missing or incorrect, please file a bug.