무엇이 올바른 방법에 대해 강타 스크립트 작업을 추가하려면 crontab 등 그
- 이 없을 것이 중복된 작업
- crontab 파일은에 의존
- (선택적)가 되는 한-라이너
이 아래의 솔루션이지만,그것은 영향을 미치지 않는 출력 실행 crontab -l
.
grep 'some_user python /mount/share/script.py' /etc/crontab || echo '*/1 * * * * some_user python /mount/share/script.py' >> /etc/crontab
변환하는 노력에 영향을 미치는 그것 crontab -l
,
(crontab -l | grep '/mount/share/script.py') || { crontab -l; '*/1 * * * * some_user python /mount/share/script.py >> /root/foo/logs/foo.cron.log 2>&1'; } | crontab -
하지만 이 명령을 실행하는 오류:
-bash: */1 * * * * some_user python /mount/share/script.py >> /root/foo/logs/foo.cron.log 2>&1: No such file or directory