Unable to setup Crontab file
-
Following the tutorial for setting up a crontab to run a task:
https://docs.onion.io/omega2-docs/running-a-command-on-a-schedule.html
But each time, receive the following error message after trying to close and save with
:wq
Any suggestions?
Thanks in advance!
-
@CoffeeCat it sounds like there is an issue with your crontabs directory, assuming you have nothing in crontabs you need, you can use this command sequence to resolve the issue:
rm -rf /etc/crontabs
mkdir /etc/crontabsThen try starting again at crontab -e
BTW instead of :wq command you can use ZZ to save and quit.
-
Thanks, I will give that a try soon.
In the meantime, update the ric.local file at
/etc/rc.local
Using this page as a reference:
https://docs.onion.io/omega2-docs/running-a-command-on-boot.html
It runs the program, but think getting the Crontab to work is “best practice” than keeping the Omega2 in an indefinite boot cycle (flashing light).
-
Completed the steps you recommend and working through this issue, and keep encountering this message when trying to enter the first line:
Trying to enter the following:
# * * * * * python3 plantTracker.py #
I have no clue as to what is causing it.
Thanks again!
-
@CoffeeCat you need to press the letter i to get vi into insert mode.
crontab -e uses the vi editor. Vi has 2 modes, command mode and insert mode. If you are in insert mode you can type # and it will be inserted. If you are not in insert mode, you are in command mode, in which case # is interpreted as a command that does not exist.
So press i to put yourself into insert mode, then you can type the # etc
-
Thanks for the assistance, it works now!