开发者

Setup a cronjob from commandline

开发者 https://www.devze.com 2023-04-04 03:46 出处:网络
I want to setup a cronjob to execute a shell script every 5 minutes on my ubuntu server. So I enter the following in the command line:

I want to setup a cronjob to execute a shell script every 5 minutes on my ubuntu server. So I enter the following in the command line:

sudo crontab -e

That returns status code 137 and lets me edit the crontab in vi editor. I enter the following

*/15 * * * * myScript.sh

After that I enter ;wq and I get following message:

crontab: "/usr/bin/sensible-editor" exited with status 1

开发者_运维百科Whats wrong? How can I enter a cronjob?


the correct sequence for exiting vi is

:wq

not ;wq

also, try changing the editor to something more user-friendly, e.g. nano

# export EDITOR="/usr/bin/nano"
# crontab -e
0

精彩评论

暂无评论...
验证码 换一张
取 消