MacOS – Crontab -l command working. No other crontab command is working

cronmacos

New to crontab, I wanted to experiment.

Running the command crontab -l gave me the following answer crontab: no crontab for User_1

Every time I tried to issue a command like 1 16 24 10 6 ping -D -c 1 www.google.com I got the error "zsh: command not found".

Every time I modified the first number of the crontab command I got an error message saying, if for example 15 is the first number of the command, zsh: command not found: 15.

For info:

Mac OS X 10.12.6.
zsh 5.8

which crontab: /usr/bin/crontab

/usr/bin is in my path.

Best Answer

You need to edit your crontab to make changes. Run

EDITOR=nano crontab -e

to use the nano editor for this. Your (initially empty) crontab will be shown and can be edited (e.g. by adding the line you had in your question). Then press Ctrl-O, Return, Ctrl-X to save the changes and quit the editor.