我想從 DD-WRT 路由器建立一個 cron 作業,wget 是來自遠端位置的圖像。該影像將被傳送到遠端 FTP 伺服器進行儲存。過程每分鐘重複一次,以當前時間命名 ftp 上的目標圖像:
wget: get file from -> http://37.***.9.95/fullsize.jpg
ftp: put fullsize.jpg -> ftp://83.***.151.224/shares/camera/dateTimeNow.jpg
其中 dateTimeNow 是當前時間。用於儲存的 ftp 伺服器不夠智能,除了 FTP 之外,既沒有 cron 也沒有其他東西。然而,DD-WRT 設備有 cron!
答案1
如果curl
可用,類似這樣的東西應該可以工作(未經測試;為date
命令選擇您自己的時間戳格式):
curl http://source/image.jpg | curl --upload-file - "ftp://destination/$(date +%F).jpg"