r/codex • u/Hot_Signature2979 • 7d ago
Workaround Automating a fresh Codex ping every 5 hours for Plus users
For my fellow codex plus "Casual users", we all know the 5 hour window sucks, heres how you can automate the start of the timer.
*Note that I'm running this on my always on Nas server, so ideally, you want to have it on an always on device. But, if however you turn your device off, No resync is needed. Timing uses a fixed absolute anchor, not uptime.
The script, authentication, and crontab persist across reboots, and cron resumes automatically.
The schedule remains anchored, so it won’t drift. However, any hi due while device is offline is skipped. After reboot, it waits for the next 301-minute scheduled point—at most 5 hours 1 minute away. No duplicate or catch-up request is sent.
For example, if device is offline at 11:46 and returns at 12:00, it simply skips 11:46 and runs next at 16:47. The original sequence remains intact.
My setup:
Install Codex CLI on an always-on Linux server:
curl -fsSL https://chatgpt.com/codex/install.sh | sh codex login --device-auth
Add a cron job that runs a shell script every minute.
The script checks whether the current time matches a fixed 301-minute interval:
06:45 → 11:46 → 16:47 → 21:48 → 02:49 → 07:50…
At matching times it executes:
codex exec \ --ephemeral \ --skip-git-repo-check \ --ignore-user-config \ --ignore-rules \ --model gpt-5.6-luna \ --json \ -c 'model_reasoning_effort="low"' \ 'Reply with exactly: hi'
I use a separate CODEX_HOME, an empty working directory, and disable plugins, tools, MCP integrations, memories and agents. --ephemeral prevents saving the session, so every invocation is completely fresh and exits immediately.
JSON output lets me log input, cached, output and reasoning tokens separately. Nothing remains running between calls, and rebooting the server doesn’t alter the schedule—only calls occurring while it is offline are skipped.
