فموضوع فى منتدى مطور
كان فى موضوع بيتكلم عن ال for
وكان سؤال كارم كالتالى :
لديك الكثير من المواقع منها من نقل خارج سيرفرك ومازال له بك اب عندك كيف تنضف البك اب من المواقع الى غير موجودة لديك بالنظام الان .
وقمت بعمل سكربت بسيط يقوم بهذه العملية
#!/bin/bash
# Auther : Eng.M7MoDls /backup/cpbackup/daily/ >/tmp/backuplist.txt
ls /var/cpanel/users >/tmp/userlist.txt
awk -F”.tar.gz” ‘{ print $1 }’ /tmp/backuplist.txt >/tmp/f1.txt
diff -w -B /tmp/userlist.txt /tmp/f1.txt | awk ‘{print $2}’ >/tmp/last.txt
cat /tmp/last.txt
echo -n “Are you sure that is backup you need to delete ?(yes/no)”;read answer
if [ $answer = yes ];then
for i in `cat /tmp/last.txt`
do
rm -rf $i.tar.gz
done
echo “all backup that doesn’t have account was deleted”
else
echo “ok i’ll skip this fot you at this time”
fi
rm -rf /tmp/*.txt





nice shell script ya 7oda you remind me with the old times ya man
the old time still there ya 3amor
thank you ya man