Failed to edit crontab

I am trying to edit my crontab, but I just can't open it!

So, with my user foo, I just type:

crontab -e

Then I got:

no crontab for foo - using an empty one
nano: No such file or directory
crontab: "nano" exited with status 1

So, I first tried:

export EDITOR=nano

I repeated, and I have exactly the same result. I also tried setting my editor to vim using

export EDITOR=vim

no crontab for foo - using an empty one
vim: No such file or directory
crontab: "vim" exited with status 1

But I get the same thing over and over again. How the hell can I open my crontab and then edit it?

Does anyone know why ?!

+4
source share
6 answers

This post is normal because you still don't have crontab for this user:

no crontab for foo - using empty

Regarding the following:

nano / vim: No such file or directory

crontab: "nano" 1

, . :

export EDITOR=/usr/bin/nano

export EDITOR=/usr/bin/vi
+5

ec2.

no crontab for ec2-user - using an empty one
/bin/sh: /usr/bin/vi: No such file or directory
crontab: "/usr/bin/vi" exited with status 127

VIM , , crontab -e . :

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export EDITOR=/usr/bin/vi

, :

which vi
alias vi='vim'
/usr/bin/vim

vim vi

export EDITOR=/usr/bin/vim

crontab -e

+3

, nano , PATH. which pico, "pico" , export EDITOR=pico, crontab -e.

script, EDITOR , ​​ .

+1

, . , , , cronie cron. fcron - . , :

pacman -R cronie
pacman -S fcron

crontab -e fcrontab -e, , . . , ...

0

Sublime , .bashrc:

# In .bashrc
export EDITOR="subl -w"

:

> source ~/.bashrc
> crontab -e
crontab: subl -w: No such file or directory
crontab: "subl -w" exited with status 1

:

> which subl
/usr/local/bin/subl
> ls -la /usr/local/bin/subl
... /usr/local/bin/subl -> /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl


# In .bashrc
export EDITOR="/usr/local/bin/subl -w"

:

> source ~/.bashrc
> crontab -e
crontab: /usr/local/bin/subl -w: No such file or directory
crontab: "/usr/local/bin/subl -w" exited with status 1

, -w:

# In .bashrc
export EDITOR="/usr/local/bin/subl"

:

> source ~/.bashrc
> crontab -e
# opened Sublime

nano, .

0

The decision not to install "another editor"

The solution is to find out the problem and solve it.

This is a problem between your terminal application and its configuration with the remote shell condition.

Decision

export TERM=xterm
crontab -e

You can add such .bashrc, .zshrc .... to your shell configuration file.

0
source

Source: https://habr.com/ru/post/1527458/


All Articles