Skip to content

Instantly share code, notes, and snippets.

@secemp9
Created November 27, 2022 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secemp9/0b24cb31444a7f3069df5efaddc924e2 to your computer and use it in GitHub Desktop.
Save secemp9/0b24cb31444a7f3069df5efaddc924e2 to your computer and use it in GitHub Desktop.
start crontab with the given command (deduplicate entries too)
cronadd() {
if crontab -l | grep -wq -- "$@"; then
:
else
(crontab -l 2>/dev/null; echo "$@") | crontab -
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment