0

Centos 7 で Incron を使用してディレクトリの変更を監視し、それらの変更をローカルの git リポジトリに戻そうとしています。

テストとして、以下を作成しました。

/root/srv    <-- The live source directory
/root/git    <-- The backup location directory
/root/bin/git-autocommit    <-- The script that does the backup and move

私の git-autocommit スクリプトは次のようになります: #!/bin/bash

REP_DIR="/root/git"       # repository directory
NOTIFY_DIR="/root/srv"    # directory to version

cd $REP_DIR
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git add .
GIT_WORK_TREE=$NOTIFY_DIR /usr/bin/git commit -a -m "auto"

そして、私はそれを実行可能にしました。

私は今実行しようとしています:

incrontab -e /root/srv IN_MODIFY,IN_CREATE,IN_MOVED_FROM,IN_MOVED_TO /root/bin/git-autocommit

しかし、私はこのエラーを受け取り続けます:

invalid arguments - operation and source file cannot be combined

何が起こっているのか正確にはわかりません。

4

1 に答える 1

0

この回答にはおそらく遅すぎますが、モニターの追加は2つのステップで行われます

incrontab -e 

ファイルを開き、その中にコマンドを追加して保存します

/root/srv IN_MODIFY,IN_CREATE,IN_MOVED_FROM,IN_MOVED_TO /root/bin/git-autocommit
于 2016-12-08T17:23:40.993 に答える