???????????Linux?е????
???????????? ???????[ 2014/11/10 10:40:38 ] ????????Linux ?????? ?????
?????嵥 9.??????????????????????
????filenameNow=$(awk /$filename/'{print $1}' ~/trash/.log)
????filenamebefore=$(awk /$filename/'{print $2}' ~/trash/.log)
????echo "you are about to restore $filenameNow??original name is $filenamebefore"
????echo "original path is $originalPath"
?????嵥 10.???????????λ?ò??????????
echo "Are you sure to do that?[Y/N]"
read reply
if [ $reply = "y" ] || [ $reply = "Y" ]
then
$(mv -b "$HOME/trash/$filename" "$originalPath")
$(sed -i /$filename/'d' "$HOME/trash/.log")
else
echo "no files restored"
fi
??????????????? trash ??
??????? delete ??????????????????????????????????????????????????trash ???????????????????????????????????????????? trash ???μ?????????á???????????????????????д??? 7 ??????????????????????????????????????????? Linux ????? crontab??
????Crontab ?? Linux ??????????г???????????????????????????????????????????Crontab ?????????????????е??????????????е????????????иù??????? Linux ?????????????????????????
????1??????е???????????????????е???????籸????????????????
????2????????е????????????????????????????????? 10 ???????????????????????????Щ?????????????????????á?
?????????д crontab ???????????? cleanTrashCan.???嵥 10 ??????y???????????????
?????ж??????е?????????????????? 7 ???????????????????????
??????????????.log ????????????????????????????????Ч?????????Ч???
?????嵥 11.??????????????? 7 ???????????.log ????????
arrayA=($(find ~/trash/* -mtime +7 | awk '{print $1}'))
for file in ${arrayA[@]}
do
$(rm -rf "${file}")
filename="${file##*/}"
echo $filename
$(sed -i /$filename/'d' "$HOME/trash/.log")
done
?????????д??????? chmod ????????????????????? crontab –e ???????????μ?????????
????10 18 * * * /bin/ cleanTrashCan
?????????????????????????? 6 ?? 10 ????? cleanTrashCan ???
???????????????????trash ???С??????Ч???????????????????????????????????????
??????????
??????????? delete ?????logTrashDir ?????restoreTrash ????? cleanTrashCan ???/bin ???£?????? chmod +x delete restoreTrash logTrashDir cleanTrashCan ????????????????????????
???????? delete ?????????????????????/usr ???μ? useless ???????????????????λ????????????·????·??????????????磺delete useless??delete ./useless ???? delete /usr/useless????й?????? 1 ?????
????? 1.delete ?????й???
??????????useless ???????????????????????$HOME/trash ?£???????????????? 2.?????
????? 2.???????
?????????.log ?????? 3.?????
????? 3.log ???????
????????????????????????????????ü???????????? restoreTrash ??????????????????·???£?restoreTrash ~/trash/useless_20140923_06_28_57??????????????? 4 ???:
????? 4.restoreTrash ?????????
??????/usr ??????????? useless ????????????????
????? 5.useless ????????
???????
??????????? Windows ?л???????????? Linux ????????????????Ч??????????????????????????????????????????/bin ???£??????? crontab ??????? Linux ????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11