Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- date=`date`
- echo "$date Begining file looking at infin.turbo.nsk.su"
- #file=`ssh -l techstat 212.20.30.169 ls mail-gorny`
- file=`ssh -l dranica 212.20.30.169 ls mail-gorny`
- # echo "$file"
- declare -A arr
- db_pass="root"
- db_user='root'
- db_name='test'
- if [[ -n $file ]]
- then
- for i in $file
- do
- scp dranica@212.20.30.169:~/mail-gorny/$i /home/mark/work
- while read line
- do
- IFS=' = '
- set -- $line
- case "$1" in
- "LOGIN" )
- login="$2"
- continue
- ;;
- "TASK" )
- if [ "$2" == "LOCK" ];
- then
- active=0
- else
- active=1
- fi
- continue
- ;;
- esac
- done < "/home/mark/work/$i"
- #mysql --user="$db_user" --password="$db_pass" --database="$db_name" --execute="UPDATE mailbox AS m,alias AS a SET m.active =$active ,a.active =$active WHERE m.username = a.goto AND m.username =$login;"
- mysql --user root --password="$db_pass" --database test -se "INSERT INTO test.documents (id, group_id, date_added, title, documentscol, content) VALUES ('6514935', $active, '3', '4', '5', '6');"
- #ssh 212.20.30.169 rm -f mail/$i
- rm "/home/mark/work/$i"
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement