diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/sdep-checknow | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/sdep-checknow b/scripts/sdep-checknow index 4771957..2cb8f68 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,8 +14,6 @@ | |||
| 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/share}/sdep" | ||
| 18 | |||
| 19 | #notify="notify-send -t 3600000" | 17 | #notify="notify-send -t 3600000" |
| 20 | notify=herbe | 18 | notify=herbe |
| 21 | title="$(date +%H:%M)" | 19 | title="$(date +%H:%M)" |
| @@ -25,17 +23,17 @@ sdepnotify() { | |||
| 25 | } | 23 | } |
| 26 | 24 | ||
| 27 | # One-off events | 25 | # One-off events |
| 28 | sdepnotify <"$sdepdata/once" | 26 | sdepnotify <"SDEPDATA/once" |
| 29 | 27 | ||
| 30 | # Daily events | 28 | # Daily events |
| 31 | sed "s/^/$(date +%Y-%m-%d) /" <"$sdepdata/daily" | sdepnotify | 29 | sed "s/^/$(date +%Y-%m-%d) /" <"SDEPDATA/daily" | sdepnotify |
| 32 | 30 | ||
| 33 | # Weekly events - needs GNU date (try -j intead of -d on BSD) | 31 | # Weekly events - needs GNU date (try -j intead of -d on BSD) |
| 34 | while read line; do | 32 | while read line; do |
| 35 | weekday=$(echo "$line" | sed "s/ .*$//") | 33 | weekday=$(echo "$line" | sed "s/ .*$//") |
| 36 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" | 34 | echo "$line" | sed "s/^[ ]*[^ ]* /$(date -d $weekday +%Y-%m-%d) /" |
| 37 | done <"$sdepdata/weekly" | \ | 35 | done <"SDEPDATA/weekly" | \ |
| 38 | sdepnotify | 36 | sdepnotify |
| 39 | 37 | ||
| 40 | # Monthly events | 38 | # Monthly events |
| 41 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"$sdepdata/daily" | sdepnotify | 39 | sed "s/^[ ]*/$(date +%Y-%m-)/" <"SDEPDATA/daily" | sdepnotify |
