
gitlab을 "자동 업데이트"하려고 합니다. 업데이트를 확인하고, 업데이트가 가능할 때 설치하고, 결과를 이메일로 보내는 쉘 스크립트를 만들었습니다. bash에서 루트로 스크립트를 시작할 때 이 모든 것이 터미널에서 완벽하게 작동합니다. 그래서 작업을 예약 crontab -e
하고 매일 실행되도록 설정했습니다.
매우 중요한 내용이 없는 개인용 홈 gitlab 서버가 되어서는 안 됩니다. 실제 프로덕션 환경에서는 절대 이런 일을 하지 않을 것입니다.
업데이트 프로세스의 출력은 로그 파일로 파이프됩니다. cronjob이 실행될 때마다 실패합니다. 로그 파일의 출력은 다음과 같습니다.
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
gitlab-ce
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 357 MB of archives.
After this operation, 2,778 kB of additional disk space will be used.
Get:1 https://packages.gitlab.com/gitlab/gitlab-ce/debian stretch/main amd64 gitlab-ce amd64 9.3.8-ce.0 [357 MB]
apt-listchanges: Reading changelogs...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Fetched 357 MB in 17s (20.3 MB/s)
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
정확히 무슨 일이 일어나고 있는 걸까요? 나는 그것이 물건 등을 찾을 수 없다는 것을 알았지만 cronjob은 root
마치 루트로 추가한 것처럼 실행되어야 합니까?
일부 확인, 결과 이메일 전송 등 외에도 쉘 스크립트는 기본적으로 다음과 같이 실행됩니다.
apt-get install --only-upgrade gitlab-ce &>> $LOGFILE
어떻게 해결할 수 있나요?