fixing timesting examples and stripping "at"
This commit is contained in:
parent
f32bf5495b
commit
19ccb76235
2 changed files with 5 additions and 3 deletions
|
|
@ -59,7 +59,7 @@ systab accepts several time formats:
|
|||
| Relative | `in 5 minutes` | One-time |
|
||||
| Relative | `tomorrow` | One-time |
|
||||
| Absolute | `2025-06-15 14:30` | One-time |
|
||||
| Absolute | `next tuesday at noon` | One-time |
|
||||
| Absolute | `next tuesday at 9am` | One-time |
|
||||
| Systemd keyword | `hourly`, `daily`, `weekly`, `monthly` | Recurring |
|
||||
| Systemd OnCalendar | `*:0/15` (every 15 min) | Recurring |
|
||||
| Systemd OnCalendar | `*-*-* 02:00:00` (daily at 2am) | Recurring |
|
||||
|
|
@ -67,7 +67,7 @@ systab accepts several time formats:
|
|||
|
||||
Relative and absolute formats are parsed by `date -d`. Systemd OnCalendar values are passed through directly.
|
||||
|
||||
Note: `date -d` does not technically like the "*in* 5 minutes" syntax. `systab` removes the offending "in".
|
||||
Note: `date -d` does not technically like "*in* 5 minutes" or "*at*" between day and time. `systab` strips "in" and "at" before passing to `date -d`.
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
|||
4
systab
4
systab
|
|
@ -51,7 +51,7 @@ Management Options:
|
|||
TIME FORMATS:
|
||||
Natural: "every 5 minutes", "every day at 2am", "every monday at 9am"
|
||||
Relative: "in 5 minutes", "in 2 hours", "tomorrow"
|
||||
Absolute: "2025-01-21 14:30", "next tuesday at noon"
|
||||
Absolute: "2025-01-21 14:30", "next tuesday at 9am"
|
||||
Systemd: "daily", "weekly", "hourly", "*:0/15" (every 15 min)
|
||||
|
||||
EXAMPLES:
|
||||
|
|
@ -161,8 +161,10 @@ parse_time() {
|
|||
|
||||
# Try to parse with date command (one-time specs)
|
||||
# Strip "in " prefix for natural phrasing ("in 5 minutes" → "5 minutes")
|
||||
# Strip " at " before times ("next tuesday at noon" → "next tuesday noon")
|
||||
local date_spec="$time_spec"
|
||||
[[ "${date_spec,,}" == in\ * ]] && date_spec="${date_spec:3}"
|
||||
date_spec="${date_spec// at / }"
|
||||
local parsed_date
|
||||
if parsed_date=$(date -d "$date_spec" '+%Y-%m-%d %H:%M:%S' 2>/dev/null); then
|
||||
echo "$parsed_date"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue