diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/sdep-checknow | 12 |
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 | ||
| 17 | sdepdata="${XDG_DATA_HOME:-$HOME/.local}/sdep" | ||
| 18 | |||
| 17 | #notify="notify-send -t 3600000" | 19 | #notify="notify-send -t 3600000" |
| 18 | notify=herbe | 20 | notify=herbe |
| 19 | title="$(date +%H:%M)" | 21 | title="$(date +%H:%M)" |
| @@ -23,17 +25,17 @@ sdepnotify() { | |||
| 23 | } | 25 | } |
| 24 | 26 | ||
| 25 | # One-off events | 27 | # One-off events |
| 26 | sdepnotify <"SDEPDATA/once" | 28 | sdepnotify <"$sdepdata/once" |
| 27 | 29 | ||
| 28 | # Daily events | 30 | # Daily events |
| 29 | sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | sdepnotify | 31 | sed "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) |
| 32 | while read line; do | 34 | while 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) /" |
| 35 | done <"SDEPDATA/weekly" | \ | 37 | done <"$sdepdata/weekly" | \ |
| 36 | sdepnotify | 38 | sdepnotify |
| 37 | 39 | ||
| 38 | # Monthly events | 40 | # Monthly events |
| 39 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" | sdepnotify | 41 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" | sdepnotify |
