![시스템 타이머 및 마운트를 찾을 수 없습니다.](https://linux55.com/image/150854/%EC%8B%9C%EC%8A%A4%ED%85%9C%20%ED%83%80%EC%9D%B4%EB%A8%B8%20%EB%B0%8F%20%EB%A7%88%EC%9A%B4%ED%8A%B8%EB%A5%BC%20%EC%B0%BE%EC%9D%84%20%EC%88%98%20%EC%97%86%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
4시간마다 실행되도록 시스템 시간을 설정하려고 합니다. 타이머가 실행되면 스크립트를 실행하여 일부 데이터 파일을 업데이트합니다. 나는 팔로우한다systemd 타이머는 매 2시간마다 매시 30분에 작동합니까?그리고15분마다 시스템 타이머.
문서 /etc/systemd/system/ftc-data.service
:
[Unit]
Description=Fetch FTC Do Not Call data files
[Service]
Type=oneshot
ExecStart=/var/ftc/ftc-data/fetch-data.sh
문서 /etc/systemd/system/ftc-data.timer
:
[Unit]
Description=Run ftc-data.service every 4 hours
[Timer]
OnCalendar=00/4:00
[Install]
WantedBy=timers.target
여기서 문제가 발생합니다.
systemctl enable /etc/systemd/system/ftc-data.timer
systemctl start /etc/systemd/system/ftc-data.timer
systemctl enable /etc/systemd/system/ftc-data.service
명령의 결과는 다음과 같습니다.
# systemctl enable /etc/systemd/system/ftc-data.timer
# systemctl start /etc/systemd/system/ftc-data.timer
Failed to start etc-systemd-system-ftc\x2ddata.timer.mount: Unit etc-systemd-system-ftc\x2ddata.timer.mount not found.
# systemctl enable /etc/systemd/system/ftc-data.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
instance name specified.
을(를) 활성화하려고 할 때 문제가 시작되는 것 같습니다 ftc-data.timer
. 나는 이해하려고 노력한다Failed to start etc-systemd-system-ftc\x2ddata.timer.mount: Unit etc-systemd-system-ftc\x2ddata.timer.mount not found.
그런데 검색을 해보니 안타가 없네요. 게시물을 찾았어요초보자 코너 » 단위 타이머그런데 systemd의 타이머가 너무 지저분해서 이 사람이 다시 cron을 사용하기 시작했습니다.
여기있어마운트 시스템문서이지만, 읽은 후에 문제가 무엇인지 알 수 있다면 빌어먹을. 파일 시스템 마운트가 어떤 관련이 있는지 모르겠습니다. 제가 하고 싶은 것은 4시간마다 스크립트를 실행하는 것입니다.
지금은 정말 그리워요 cron
. cron
간단하고 효과적입니다. 더 복잡한 것으로 대체되었지만 작동하지 않습니다. 한숨을 쉬다...
(systemd 외에) 무엇을 수정해야 합니까?
이는 강제 모드의 SELinux를 사용하는 Fedora 29 서버입니다. 이는 다음과 관련이 있을 수 있습니다.
# ls -Zd /var/ftc/ftc-data/fetch-data.sh
unconfined_u:object_r:httpd_sys_content_t:s0 /var/ftc/ftc-data/fetch-data.sh
웹 서버는 /var/ftc/ftc-data/
디렉터리의 문서를 제공해야 하므로 액세스할 수 있습니다.Nginx 하위 디렉터리 권한 거부 문제를 해결하는 방법은 무엇입니까?
답변1
당신은 제공해야이름파일이 아닌 장치의 경로입니다.
다음을 수행해야 합니다.
systemctl enable ftc-data.timer
systemctl start ftc-data.timer
systemctl enable ftc-data.service