aboutsummaryrefslogtreecommitdiff
path: root/scripts/sdep-checknow
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/sdep-checknow12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/sdep-checknow b/scripts/sdep-checknow
index 2cb8f68..404d461 100755
--- a/scripts/sdep-checknow
+++ b/scripts/sdep-checknow
@@ -3,7 +3,7 @@
3# Run this every minute (for example using cron) to receive a notification 3# Run this every minute (for example using cron) to receive a notification
4# when an event happens. 4# when an event happens.
5# 5#
6# The events are read from the following files in SDEPDATA folder: 6# The events are read from the following files in $sdepdata folder:
7# once: events that only happen once; full date needs to be specified 7# once: events that only happen once; full date needs to be specified
8# daily: events that happen every day; only specify the time in HH:MM format 8# daily: events that happen every day; only specify the time in HH:MM format
9# weekly: only specify Weekday + time 9# weekly: only specify Weekday + time
@@ -14,6 +14,8 @@
14# might have to change if you are not on Linux (on some systems you can 14# might have to change if you are not on Linux (on some systems you can
15# accomplish the same with -j). 15# accomplish the same with -j).
16 16
17sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep"
18
17#notify="notify-send -t 3600000" 19#notify="notify-send -t 3600000"
18notify=herbe 20notify=herbe
19title="$(date +%H:%M)" 21title="$(date +%H:%M)"
@@ -23,17 +25,17 @@ sdepnotify() {
23} 25}
24 26
25# One-off events 27# One-off events
26sdepnotify <"SDEPDATA/once" 28sdepnotify <"$sdepdata/once"
27 29
28# Daily events 30# Daily events
29sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | sdepnotify 31sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | sdepnotify
30 32
31# Weekly events - needs GNU date (try -j intead of -d on BSD) 33# Weekly events - needs GNU date (try -j intead of -d on BSD)
32while read line; do 34while read line; do
33 weekday=$(echo "$line" | sed "s/ .*$//") 35 weekday=$(echo "$line" | sed "s/ .*$//")
34 echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" 36 echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /"
35done <"SDEPDATA/weekly" | \ 37done <"$sdepdata/weekly" | \
36sdepnotify 38sdepnotify
37 39
38# Monthly events 40# Monthly events
39sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" | sdepnotify 41sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" | sdepnotify

Generated with cgit - Back to sebastiano.tronto.net