![](/img/trans.png)
[英]How to run inotifywait continuously and run it as a cron or deamon?
[英]Can I run inotifywait continually on a Linux Server without cron or incron
我在服務器上為此目錄創建一個git repo。 我想擁有的是每當有文件移入目錄時,git push就會推送存儲庫並提交。 我試過incrontab執行腳本。 但是似乎我的服務器不喜歡incrontab,每次都崩潰。
我可以在終端上運行此inotifywait。 但是,一旦我關閉終端,它就會停止觀看。 那么,有沒有辦法可以在Linux服務器上連續運行inotifywait?
這是我的Inotifywait代碼
while inotifywait -re modify,attrib,move,close_write,create,delete,delete_self /path/to/script.sh
do
cd /path/to/dir
git pull
git add .
git commit -m 'updated'
git push
echo "done!"
done
我真的只想使用inotify,而不使用cron東西。 我已經在cron和incron,incrontab上工作了很長時間。 沒運氣。
有人有想法么? 謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.