this post was submitted on 25 Oct 2025
15 points (100.0% liked)

commandline

2171 readers
9 users here now

founded 2 years ago
MODERATORS
 

Use ln -sf to update a symlink after each cron run:

0 */8 * * * TIMESTAMP=$(date +\%Y-\%m-\%dT\%H;\%M;\%S) && LOG="$HOME/logs/${TIMESTAMP}_job.log" && /path/to/script.sh >> "$LOG" 2>&1 && ln -sf "$LOG" "$HOME/logs/latest_job.log"

Any active communities where I can learn more cool things like this?

top 4 comments
sorted by: hot top controversial new old
[–] nous@programming.dev 2 points 4 months ago (2 children)

Or use systems timers which keep track on this information for you. Can even tell you when the job will next run and automatically captures the logs and exit status from the runs.

[–] CoderSupreme@programming.dev 2 points 4 months ago* (last edited 4 months ago)

Or use systems timers

systemd timers? Isn't that dependent on whether or not there is systemd? I thought there were Linux distros that don't use it.

[–] CoderSupreme@programming.dev 1 points 4 months ago

Communities / Forums

Resources / Tutorials