With #cron or #systemd timers, how can I run something every 2 minutes, except between 23:50 and 00:10?

I don't think there's a way to specify this, right? I can see having to write wrapper scripts to check the time and exit early.

#linux #unix #sysAdmin

Currently I'm using /usr/bin/ifNotNearMidnight as:

#!/bin/bash
t=$(date +\%H\%M)
if [[ "$t" > 2350 ]] || [[ "$t" < 0010 ]]
then
exit 1
fi

And then in cron:

* * * * * ifNotNearMidnight && ( cd /blah/ ; doTheThing )

@artfulrobot Are leading zeros not octal in this context?
@dalias I don't think so, I'm using <> which are a string comparators, not -gt or -lt