我會給出一個廣義的答案。
你可以在上傳觸發腳本,或者如果由於某種原因,是不可能的,那麼Linux有幾個notify
的API命令可以用來watch
目錄。
一旦這樣做了,你將需要傳輸文件。同樣,不止一種方式做到這一點,但一些可能性將是scp
,sftp
或HTTP POST(可能使用curl
)。如果使用scp
/sftp
,則應使用基於密鑰的身份驗證而不是密碼。
如果(並且只有在我假設的情況下)工作成功,您會希望刪除文件(如果沒有,也許您可以使用mail
命令向某人抱怨和/或使用mv
命令將問題文件移動到另一個目錄中)。
如果你想使用bash自動執行某些的這一點,那麼你應該看看以下一些bash特性:
&&
如果上述命令成功將執行以下命令(返回與退出的0)
||
代碼,如果前面的命令失敗(退出代碼將執行以下命令!= 0)
if then fi
while do done
最後,我的系統,下面的命令顯示了一些工具,你可能要考慮的:
apt-cache search inotify
-
incron - cron-like daemon which handles filesystem events
inosync - notification-based directory synchronization daemon
inoticoming - trigger actions when files hit an incoming directory
inotify-hookable - blocking command-line interface to inotify
inotify-tools - command-line programs providing a simple interface to inotify
gamin - File and directory monitoring system
clsync - live sync tool based on inotify, written in GNU C
entr - Run arbitrary commands when files change
lsyncd - daemon to synchronize local directories using rsync
iwatch - realtime filesystem monitoring program using inotify
...其中的一個可能只是做你需要的所有東西...
嗨@semgmp,歡迎來到SO。在你問這裏任何問題之前,預計你會做最少的工作。看看http://www.mpipks-dresden.mpg.de/~mueller/docs/suse10.2/html/opensuse-manual_en/manual/sec.filetrans.copy.html一旦你可以做到這一點,你可以自動化整個過程http://ubuntuforums.org/showthread.php?t=233564 –