inotifywait добавление нескольких файлов одновременно
Этот сценарий оболочки должен добавить все, что помещено в папку для передачи. С одной папкой она работает нормально, но когда я добавляю более одной папки одновременно, она игнорирует вторую.
while true;
do
file=$(inotifywait -e moved_to --format %f /srv/watchfolderfilme)
file="/srv/watchfolderfilme/$file"
transmission-create -o $file.torrent -s 16384 -t http://0.0.0.0:6969/announce $file
mv $file /srv/downloads
chmod 0777 $file.torrent
cp $file.torrent /srv/newtorrentfiles
mv $file.torrent /srv/watchfoldertorrents
done
1 ответ
Решение
Пересмотрите мое решение и найдите лучшее, которое отлично работает для нескольких добавлений
inotifywait -m /srv/watchfolderfilme -e create -e moved_to |
while read path action file; do
# echo "The file '$file' appeared in directory '$path' via '$action'"
chmod 0777 $path$file
transmission-create -o /srv/newtorrentfiles/$file.torrent -s 16384 -t http://0.0.0.0:6969/announce $path$file
mv $path$file /srv/downloads
chmod 0777 /srv/newtorrentfiles/$file.torrent
cp /srv/newtorrentfiles/$file.torrent /srv/watchfoldertorrents
done