Comment on What do you prefer for a self hosted calendar?
DontNoodles@discuss.tchncs.de 1 year agoSounds good for setting the events up and getting notifications part. A good calender would also let you see the upcoming events in week, month at a glance. Cron entries are non sorted lists. Is there a cron visualizer like they have visualizers for logs?
Anafroj@sh.itjust.works 1 year ago
I organize my crontab by having group of tasks (the programs, the holidays, the housecleaning, etc), and the events (the non recurring tasks) come last, so I just list the crontab (
crontab -l
) and the list of things to come print to the screen, that block being at the end of the file.I don’t know if there is a program that lists like “what is coming this month” if you really want to filter out the rest, but it should be easy enough to write, given the format of cron rules:
crontab -l | grep '*' | awk '{print $4 "," $3 "," $2 "," $1 " " $0 }' | sort -n | grep -E "^$(date '+%-m')"
crontab -l
: list the crontabgrep ‘*’
: keeps only rules (removing blank lines and comments)awk […]
: print the whole line ($0
), prepend by the 4th field (the month), the 3rd (the day), the 2nd (the hour) and the 1st (the minutes)sort -n
: sort everything numerically, so that all tasks are now in their execution date orderdate '+%-m
: prints the current month, not zero padded (thanks to the ‘-’)grep -E ‘^’
: keep only lines which starts with the current month numberThis could but refined further to display dates in a more friendly format. But as usual, Unix is your friend. :)