Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- file=/mnt/sda1/data-mysql/mysql/sms/toutbox.MYD
- fingerprintfile=/tmp/.bla.md5savefile
- while true; do
- if [ ! -f $file ]
- then
- echo "ERROR: $file does not exist - aborting"
- exit 1
- fi
- filemd5=`md5sum $file | cut -d " " -f1`
- if [ -z $filemd5 ]
- then
- echo "The file is empty - aborting"
- exit 1
- else
- :
- fi
- if [ -f $fingerprintfile ]
- then
- savedmd5=`cat $fingerprintfile`
- if [ -z $savedmd5 ]
- then
- echo "The file is empty - aborting"
- exit 1
- fi
- if [ "$savedmd5" = "$filemd5" ]
- then
- :
- else
- echo "File has been changed"
- #tambahkan bagian ini
- eval $(mysql -u root -ppassword sms -N -e "select concat('sms_kirim ',hp,' \"',isi,'\";') from toutbox where hp is not null or hp!=''")
- mysql -u root -ppassword sms -e "truncate toutbox"
- # --end--
- echo
- fi
- fi
- echo $filemd5 > $fingerprintfile
- sleep 1
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement