Skip to content

Instantly share code, notes, and snippets.

@grational
Last active November 21, 2019 17:16
Show Gist options
  • Save grational/59b84a7eec106b1b85291361194a7d30 to your computer and use it in GitHub Desktop.
Save grational/59b84a7eec106b1b85291361194a7d30 to your computer and use it in GitHub Desktop.
It's a simple crontab wrapper to avoid discarding your crontab file by mistake
#!/usr/bin/env bash
set -euo pipefail
crontab_bin=/usr/bin/crontab
if (( ${#@} != 1 )); then
echo 1>&2 "${0##*/} <param>"
exit 1
fi
if [[ $1 == '-r' ]]; then
$crontab_bin -e
else
$crontab_bin $*
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment