# 使用 Homebrew, apk 安装 lockrun

查看 lockrun 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:lockrun
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install lockrun
```

  证据: local Homebrew formula metadata

### Linux

- apk (92%):

```sh
sudo apk add lockrun
```

  证据: Alpine Linux edge package indexes: lockrun from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz

## 软件包事实

- **软件包键:** brew:lockrun
- **软件包管理器:** Homebrew
- **版本:** 1.1.3
- **来源摘要:** Run cron jobs with overrun protection
- **主页:** <http://unixwiz.net/tools/lockrun.html>
- **最后更新:** 2026-05-19T13:03:29-04:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- lockrun (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.1.3
## 项目历史与用法

lockrun is a small public-domain Unix utility by Steve Friedl for running cron jobs with overrun protection. It wraps a command, takes an advisory file lock, and prevents overlapping invocations from piling up.

### 项目历史

The official Unixwiz.net page explains that lockrun was created in response to network-monitoring cron jobs that could run longer than their schedule interval. The tool was designed as a protective wrapper that checks whether another protected instance is already running before launching the requested command.

lockrun is distributed as portable C source code rather than through a hosted source repository. The official page documents building it with `gcc lockrun.c -o lockrun` and installing it into `/usr/local/bin`.

### 采用历史

The tool's natural audience is Unix administrators with cron jobs that must not overlap, especially polling and monitoring jobs. It was tested on FreeBSD and Linux, received a report of working on Mac OS X, and later gained portability work such as Solaris `lockf()` support.

Homebrew and Alpine packaging made the small C utility easier to install without manually downloading and compiling the source file.

### 使用方式

A typical crontab entry invokes `lockrun --lockfile=/var/run/name.lockrun -- command`. If the lock cannot be acquired, lockrun exits instead of launching a second copy; `--wait`, `--quiet`, `--verbose`, and `--maxtime` adjust behavior.

The official documentation warns that the lockfile should be placed in a directory protected from other users and not in `/tmp`, because a writable directory could enable symlink attacks against the lockfile path.

### 为什么软件包爱好者会关心

lockrun is package-manager-relevant because it solves a narrow operations problem with one C file and no daemon. It overlaps with `flock(1)` patterns, but its documented cron-oriented interface made it a remembered admin tool.

Its packaging story is also a reminder that not every useful Unix package has a modern VCS repository; sometimes the authoritative upstream is a source file and a carefully written HTML manual.

### 时间线

- 2006: Initial lockrun release.
- 2009: Solaris 10 `lockf()` support was added.
- 2010: `--quiet` parameter was added.
- 2012: Documentation about no kill option, `--retries`, and `setsid()` support were added.

### Related projects

- flock(1), run-one, and daemon supervisors solve adjacent locking or single-instance execution problems.
- Cacti poller scripts are used in the official documentation as a motivating cron example.

### 来源

- <http://unixwiz.net/tools/>
- <http://unixwiz.net/tools/lockrun.html>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- apk - lockrun - 1.1.3-r1: normalized package name match | Alpine Linux edge package indexes: lockrun from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Run cron job with overrun protection | http://unixwiz.net/tools/lockrun.html


## Combined YAML source

View the package source record on GitHub. [combined/lockrun.yml](https://github.com/mxcl/pkgdb/blob/main/combined/lockrun.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
