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

commandline

2171 readers
8 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?

you are viewing a single comment's thread
view the rest of the comments
[–] 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.