SHARE
TWEET

Untitled

a guest Jun 18th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. date=`date`
  3. echo "$date   Begining file looking at infin.turbo.nsk.su"
  4. #file=`ssh -l techstat 212.20.30.169 ls mail-gorny`
  5. file=`ssh -l dranica 212.20.30.169 ls mail-gorny`
  6. # echo "$file"
  7. declare -A arr
  8.  
  9. db_pass="root"
  10. db_user='root'
  11. db_name='test'
  12.  
  13. if [[ -n $file ]]
  14. then
  15.     for i in $file
  16.     do
  17.     scp dranica@212.20.30.169:~/mail-gorny/$i /home/mark/work
  18.     while  read  line
  19.         do     
  20.             IFS=' = '
  21.             set -- $line
  22.  
  23.             case "$1" in
  24.                 "LOGIN" )
  25.                     login="$2"
  26.                     continue
  27.                 ;;
  28.                 "TASK" )
  29.                     if [ "$2" == "LOCK" ];
  30.                     then
  31.                         active=0
  32.                     else
  33.                         active=1
  34.                     fi
  35.                     continue
  36.                 ;;
  37.             esac
  38.         done < "/home/mark/work/$i"
  39.  
  40.     #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;"
  41.         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');"  
  42.  
  43.         #ssh 212.20.30.169 rm -f mail/$i
  44.         rm "/home/mark/work/$i"  
  45.     done
  46. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top