Send keys over ssh connection to nano editor

Posted on

A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about Send keys over ssh connection to nano editor was one problem in server stack that need for a solution. Below are some tips in manage your linux server when you find problem about linux, cron, nano, , .

I have a situation where I am deleting the crontab and then recreate it.
So I do crontab -r and then crontab -e.

The problem I have is that crontab -e opens up nano, and I’d like a command line that can do
crontab -e then send the F3 and F2 keys, which are for save and exit.

I need to this happen since I will be sending the commands via an ssh connection so nano will not be used interactively.

I am doing this to have crontab automatically create itself a brand new crontab file with all correct permissions and header.

Thank you
ionut

No need to use any interactive editor.

Write the new schedule to a file and then simply call:

crontab  file 

See the crontab man page.

Leave a Reply

Your email address will not be published. Required fields are marked *