2016-02-13 35 views
-3

我需要一個bash腳本來刷新網頁並檢查自上次更新以來是否發生了更改。我能怎麼做?使用臨時文件?有人可以發佈代碼嗎?腳本bash更新網頁並檢查是否有不同的東西

+3

對不起每小時變化率統計文件,StackOverflow的是_not_一個免費的編碼服務。我建議你僱用一名程序員。 – arkascha

+0

請閱讀整個[旅遊](http://stackoverflow.com/tour)頁面。 – Cyrus

+0

在旅程中,嘗試搜索或兩個關於'diff'命令,你可能會發現有用的。 –

回答

1

我用這個網站來生成有關在紐約時報的網頁

#!/bin/bash 
currentDate=$(date +%k-%d-%m) 
lastDate=$(date +%k-%d-%m -d "now - 1 hour")   
historyLocation="/media/raid/mcs/webs/script/history" 
statisticsFile="/media/raid/mcs/webs/script/statistics" 
links -dump www.nytimes.com > $historyLocation/$currentDate #dumps current version 
echo $currentDate: >> $statisticsFile 
wdiff $historyLocation/$currentDate $historyLocation/$lastDate -s | tail -2 | head -1 | cut -d' ' -f14 >> $statisticsFile