Expectはうまく機能しますが、フォアグラウンドでのみ機能します。なぜですか?

Expectはうまく機能しますが、フォアグラウンドでのみ機能します。なぜですか?

このスクリプトを使用して、ストレージスラックウェア(asc、txtなどの作成)を更新します。

http://slackware.org.uk/people/alien/tools/gen_repos_files.sh

私の予想スクリプトを使って「自動化」しました。

#!/bin/bash
set -e

funct()
{
#script update repo http
pass3="proot"

    expect -c "
    spawn /usr/local/bin/gen_repos_files.sh -l /tmp/changelog
    expect \"Enter your GPG passphrase:  \"
    send \"$pass3\n\"
    interact
    "

find /srv/httpd/htdocs/repos/slackware-mg/ -type f |xargs chmod 644  -v

}

while inotifywait -qqre modify /http/srv/httpd/htdocs/repos/slackware-mg; do funct; done

完全に機能しますが、rc.localまたはcrontabで実行している場合は、シェルから起動したときにのみ機能します。動作しません。 2番目のスクリプト(gen_repos.sh)はまだ待機しています。なぜ?

ベストアンサー1

解決策が見つかりました。

例えば

nohup /usr/local/bin/aggiornailrepo.sh&

rc.localから

そしてinotifywaitで-o /dev/nullを忘れないでください。それ以外の場合は、シェルなしでは機能しません。

おすすめ記事