Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

コンテナ内にcrontabがない #139

Closed
helenwangjia opened this issue Sep 19, 2023 · 3 comments · Fixed by #140
Closed

コンテナ内にcrontabがない #139

helenwangjia opened this issue Sep 19, 2023 · 3 comments · Fixed by #140
Assignees
Labels
bug Something isn't working
Milestone

Comments

@helenwangjia
Copy link
Contributor

No description provided.

@takuma0121
Copy link
Contributor

ここのマウントが正しくできているか確認してほしい

- ./conf/crontab:/root/crontab

@takuma0121 takuma0121 added the bug Something isn't working label Sep 19, 2023
@takuma0121 takuma0121 added this to the to be decided milestone Sep 19, 2023
@takuma0121 takuma0121 changed the title コンテナの中でcrontabがない コンテナ内にcrontabがない Sep 19, 2023
@helenwangjia
Copy link
Contributor Author

helenwangjia commented Sep 20, 2023

マウントは正しくできていると思います。(OsecT20のコンテナ↓)

root@sensor:~# cat crontab
@reboot /bin/bash -c 'echo export RANDOM_TIME=$(($RANDOM\%3600)) >> /root/.profile'
@reboot /opt/ot_tools/suricata_update.sh > /dev/null 2>&1
* * * * * /opt/ot_tools/suricata_cron.sh dummy1 > /dev/null 2>&1
* * * * * /opt/ot_tools/p0f_cron.sh dummy1 > /dev/null 2>&1
* * * * * /opt/ot_tools/yaf_cron.sh dummy1 > /dev/null 2>&1
@reboot /usr/local/zeek/bin/zeekctl deploy
* * * * * /usr/local/zeek/bin/zeekctl cron
* * * * * sleep 5; /opt/ot_tools/ot_cron.sh > /dev/null 2>&1
0 * * * * /opt/ot_tools/complete_to_archives.sh > /dev/null 2>&1
0 1 * * * /bin/bash -c 'source /root/.profile; sleep $RANDOM_TIME'; /opt/ot_tools/suricata_update.sh > /dev/null 2>&1

しかし、crontab -lをしたら、問題があります。

root@sensor:~# crontab -l
no crontab for root 

@helenwangjia
Copy link
Contributor Author

helenwangjia commented Sep 20, 2023

コンテナ内にcrontab /root/crontabを実行して、エラーがあります。

sectu@sensor:~/osect_sensor$ docker exec -it osect_sensor_edge_cron_1 bash
root@sensor:/home/work# crontab /root/crontab
new crontab file is missing newline before EOF, can't install.

エラーを解決するために、OsecT20でのcrontabファイルに空行を追加しました。
テストするために、改めてビルドして、コンテナに入って、crontab -lを実行して、反映できました。

Successfully built fd2eaad7ca87
Successfully tagged cron:comtest01-sensor-recovery
sectu@sensor:~/osect_sensor$ docker exec -it osect_sensor_edge_cron_1 bash
root@sensor:/home/work# crontab -l
@reboot /bin/bash -c 'echo export RANDOM_TIME=$(($RANDOM\%3600)) >> /root/.profile'
@reboot /opt/ot_tools/suricata_update.sh > /dev/null 2>&1
* * * * * /opt/ot_tools/suricata_cron.sh dummy1 > /dev/null 2>&1
* * * * * /opt/ot_tools/p0f_cron.sh dummy1 > /dev/null 2>&1
* * * * * /opt/ot_tools/yaf_cron.sh dummy1 > /dev/null 2>&1
@reboot /usr/local/zeek/bin/zeekctl deploy
* * * * * /usr/local/zeek/bin/zeekctl cron
* * * * * sleep 5; /opt/ot_tools/ot_cron.sh > /dev/null 2>&1
0 * * * * /opt/ot_tools/complete_to_archives.sh > /dev/null 2>&1
0 1 * * * /bin/bash -c 'source /root/.profile; sleep $RANDOM_TIME'; /opt/ot_tools/suricata_update.sh > /dev/null 2>&1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants