run4ever is a command-line tool that allows you to run a specified command indefinitely, with a specified delay between each execution.
Bash while true vs run4ever — at this maturity
while true; do
echo "Hello, world!"
sleep 10
doneBut your run4ever already provides:
[X] Persistent execution
[X] Delay management
[X] Retry counter
[X] State file with PIDs
[X] --ps process visibility
[X] Signal handling
[X] Notifications (Telegram/Desktop)
[X] Password masking
[X] Structured CLI
[X] Container support
This is no longer “just a loop”. It is a lightweight self-healing job runner.
git clone github.com/mparvin/run4ever
go build -o run4everrun4ever [flags] [command] --ps : Show a list of running commands and their PIDs.
-d or --delay: Specify the delay in seconds between command executions. Default is 10 seconds.
-t or --timeout: Specify the timeout in seconds for command execution. Default is no timeout.
-v or --verbose: Enable verbose mode. This will cause run4ever to print additional output such as errors and confirmation messages.
-m or --max-retries: Maximum number of retries before giving up. -1 for infinite retries (default is -1).
-g or --background: Run command in background (daemon mode).
--notify-on: Notify on: failure, success, always.
--notify-method: Notification method: desktop, telegram, slack, email.
--telegram-token: Telegram bot token (required for Telegram notifications).
--telegram-chat-id: Telegram chat ID (required for Telegram notifications).
--telegram-custom-api: Telegram custom API URL (optional).
--slack-webhook-url: Slack webhook URL (required for Slack notifications).
--slack-channel: Slack channel (optional, can be set in webhook URL).
--email-to: Email recipient address (required for email notifications).
--email-from: Email sender address (required for email notifications).
--email-password: Email password (required for email notifications).
--email-smtp: SMTP server hostname (required for email notifications).
--email-port: SMTP server port (default is 587).
--exit-on-success: Exit when command succeeds (exit code 0).
--persist: Save job definition for restore on restart.
--restore: Restore and run all saved jobs.run4ever -d 30 echo hello worldrun4ever -d 1 --exit-on-success docker pull nginxThis will retry every second until the image is successfully pulled, then exit.
# Save a job for later restoration
run4ever -d 60 --persist my-command
# Restore all saved jobs (useful after container restart)
run4ever --restoreAll examples are in examples directory.
run4ever is a command-line tool that allows you to run a specified command indefinitely, with a specified delay between each execution.
run4ever is not a scheduler or cron replacement. For critical backups, prefer cron or systemd timers. run4ever can be used only as a retry/notification wrapper.
- Fix flags conflict between run4ever and command (Fixed)
- Add ps flag
- Move runInfinitely function to tools package
- Add github actions
- Add tests
- Add timeout flag
- Add
-gflag to run command in background - Add
-lflag to list all running jobs - Add more examples - added in examples directory
- Add bash completion
- Add notification on Success/Failure
- Add notification Desktop method
- Add notification Telegram method
- Add notification Slack method
- Add notification Email method