https://github.com/batiati/isrunning-zig
IsRunning is a very simple and lightweight Windows command-line utility to check if some processes are running or not.
https://github.com/batiati/isrunning-zig
command-line-tool docker kubernetes readiness-probe windows zig
Last synced: about 2 months ago
JSON representation
IsRunning is a very simple and lightweight Windows command-line utility to check if some processes are running or not.
- Host: GitHub
- URL: https://github.com/batiati/isrunning-zig
- Owner: batiati
- License: unlicense
- Created: 2021-10-11T23:22:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-30T16:31:19.000Z (over 4 years ago)
- Last Synced: 2025-10-10T17:57:01.839Z (9 months ago)
- Topics: command-line-tool, docker, kubernetes, readiness-probe, windows, zig
- Language: Zig
- Homepage: https://github.com/batiati/IsRunning-Zig
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IsRunning
IsRunning is a very simple and lightweight Windows command-line utility to check if some processes are running or not.
It expects a list of process's names as argument and simply exits with code `0` if they were found, or `1` otherwise.
No output or message is printed.
Usage:
```CMD
IsRunning.exe PROCESS_1 [PROCESS_2] [PROCESS_N]
```
_Examples_
```CMD
C:\> IsRunning.exe traefik.exe
C:\> echo %errorlevel%
0
```
```CMD
C:\> IsRunning.exe traefik.exe node.exe
C:\> echo %errorlevel%
0
```
```CMD
C:\> IsRunning.exe dead.exe
C:\> echo %errorlevel%
1
```
### Motivation
Its main purpose is to serve as readiness probe for containers that spawn multiple processes.
For example, a [Pod readiness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) to detect if `traefik` is running:
```yaml
readinessProbe:
exec:
command:
- C:/IsRunning.exe
- traefik.exe
failureThreshold: 3
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
```
> It's not advisable to run multiple processes on a single container, but for many reasons, it's not uncommon, especially for legacy applications in Microsoft Windows containers.
### Why not use batch script?
I used to use a batch script combining `tasklist` and `find` together:
```CMD
C:\> tasklist | find "traefik.exe"
C:\> echo %errorlevel%
0
```
It works, but it's not the most efficient solution, particularly when you call it every 5 seconds for hundreds of containers.
This utility saves a little bit of CPU and memory by removing the overhead of `CMD` interpreter and all the string processing between `tasklist` and `find`.
This utility is implemented in [Zig](https://ziglang.org/), just because we needed a native, small, fast, and secure binary to perform such task.
### Limitations
- Windows only application
- It is optimized for low memory consumption, and only works with ASCII processes names.
Please, feel free to open an issue or send a PR if you might improve this implementation in some sense.