crontab -e 간단한 질문

crontab -e 간단한 질문

저는 crontab 명령을 처음 접했고 이 명령을 작업하는 동안 갑자기 숫자를 입력하고 crontab -e를 다음과 같이 만들었습니다.


pi@raspberrypi:~ $ crontab -e
no crontab for pi - using an empty one
889


crontab을 다시 기본값으로 설정하거나 제거하는 방법이 있습니까? crontab을 사용하여 작업을 자동화하고 싶습니다.

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
"/tmp/crontab.QzVh1G/crontab" 23 lines, 898964 characters


귀하의 지시를 따르고 나면 다음과 같이 표시됩니다 export VISUAL=vi crontab -e. qa를 사용하는 것 외에는 이 파일을 편집할 수 없는 것 같습니다! 그만두다. 내가 놓친 것이 있나요?

답변1

편집기가 (으)로 설정되어 있습니다 ed. 편집기 ed아주 기본적인줄 편집기는 파일을 열 때 파일의 바이트 수를 출력합니다. 이 예에서 crontab 파일에는 889바이트가 포함되어 있습니다( 파일 내용을 보려면 편집기에서 ,p입력하고 누르십시오 ).Enter

ed아마도 당신은 그것을 편집자로 사용하고 싶지 않을 것입니다 (또는 당신이 그것을 시작했다는 것을 깨닫게 될 것입니다). 편집기를 종료하려면 를 입력 q하고 누르 Enter거나 을 누르십시오 Ctrl+D.

그런 다음 다시 실행 crontab -e하고 VISUAL환경 변수를 시스템에서 파일을 편집하는 데 가장 일반적으로 사용하는 편집기로 설정하십시오.

예를 들어 설정 방법은 다음과 같습니다. VISUAL하지만 설치한 다른 터미널 편집기를 사용할 수도 있습니다.vinano

export VISUAL=vi
crontab -e

VISUAL쉘의 시작 파일에서 값을 설정해야 할 수도 있습니다( ~/.bashrc해당 파일을 사용하는 경우 bash).

관련 정보