Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
orchard
/
CSCS
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d048b868
authored
Jan 28, 2019
by
jajapi
1
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add gads-pm, Modify check.sh
parent
edde508a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
49 deletions
GuestPM/Integration/Seocho_uxen_check.sh
MgmtPM/CMSmgmt/checkPM_cms.py
MgmtPM/CMSmgmt/cms_serverlist.txt
MgmtPM/CMSmgmt/updateSH_cms.py
GuestPM/Integration/Seocho_uxen_check.sh
View file @
d048b868
...
...
@@ -286,7 +286,12 @@ function GET_CMS_UXEN_LOG()
REFINED_UXEN3_API_LOG
=
/tmp/refined_uxenapi.log
REFINED_UWSGI_LOG
=
/tmp/uwsgi.log
DATE
=
0
date
-R
>
$DATE
MONTH
=
$(
cut
$DATE
-f
3
-d
' '
)
YEAR
=
$(
cut
$DATE
-f
4
-d
' '
)
ls
-r
$DEFAULT_UXEN3_API_LOG
| xargs
cat
>
$ENTIRE_UXEN3_API_LOG
echo
-e
"
\n\x
1b[45m"
UXENAPI
"
\x
1b[0m"
echo
-e
"
\n
----------------
\x
1b[34m"
entire uxenapi
"
\x
1b[0m---------------------
\n
"
...
...
@@ -306,7 +311,7 @@ function GET_CMS_UXEN_LOG()
tail
$DEFAULT_UWSGI_LOG
echo
-e
"
\n
----------------
\x
1b[34m"
error fail log
"
\x
1b[0m--------------------
\n
"
cat
$DEFAULT_UWSGI_LOG
|
grep
--color
=
yes
-E
"1.1 400"
|grep
--color
=
yes
-E
"
2018"
|grep
--color
=
yes
"Nov
"
cat
$DEFAULT_UWSGI_LOG
|
grep
--color
=
yes
-E
"1.1 400"
|grep
--color
=
yes
-E
"
$YEAR
"
|grep
--color
=
yes
"
$MONTH
"
echo
-e
"
\n
----------------
\x
1b[34m"
detail log
"
\x
1b[0m------------------------
\n
"
echo
-e
"
\n
Please see
$DEFAULT_UWSGI_LOG
"
...
...
@@ -324,6 +329,11 @@ function GET_WEB_UXEN_LOG()
REFINED_UXEN3_API_LOG
=
/tmp/refined_uxenapi.log
REFINED_UWSGI_LOG
=
/tmp/uwsgi.log
DATE
=
0
date
-R
>
$DATE
MONTH
=
$(
cut
$DATE
-f
3
-d
' '
)
YEAR
=
$(
cut
$DATE
-f
4
-d
' '
)
ls
-r
$DEFAULT_UXEN3_API_LOG
| xargs
cat
>
$ENTIRE_UXEN3_API_LOG
echo
-e
"
\n\x
1b[45m"
UXENAPI
"
\x
1b[0m"
echo
-e
"
\n
----------------
\x
1b[34m"
entire uxenapi
"
\x
1b[0m---------------------
\n
"
...
...
@@ -343,7 +353,7 @@ function GET_WEB_UXEN_LOG()
tail
$DEFAULT_UWSGI_LOG
echo
-e
"
\n
----------------
\x
1b[34m"
error fail log
"
\x
1b[0m--------------------
\n
"
cat
$DEFAULT_UWSGI_LOG
|
grep
--color
=
yes
-E
"1.1 400"
|grep
--color
=
yes
-E
"
2018"
|grep
--color
=
yes
"Nov
"
cat
$DEFAULT_UWSGI_LOG
|
grep
--color
=
yes
-E
"1.1 400"
|grep
--color
=
yes
-E
"
$YEAR
"
|grep
--color
=
yes
"
$MONTH
"
echo
-e
"
\n
----------------
\x
1b[34m"
detail log
"
\x
1b[0m------------------------
\n
"
echo
-e
"
\n
Please see
$DEFAULT_UWSGI_LOG
"
...
...
MgmtPM/CMSmgmt/checkPM_cms.py
View file @
d048b868
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
paramiko
import
getpass
...
...
@@ -7,66 +7,64 @@ import time
import
os
import
subprocess
#
##
initialize factor value
fac
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
fac2
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
# initialize factor value
fac
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
fac2
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
#
##
read serverlists
# read serverlists
serverlist
=
open
(
"cms_serverlist.txt"
,
'r'
)
serverhost
=
serverlist
.
readlines
()
#
##
input password
password
=
getpass
.
getpass
(
"orchard password :"
)
# input password
password
=
getpass
.
getpass
(
"orchard password :"
)
#
##
static value
# static value
username
=
"orchard"
port
=
22
#
##
check.sh
# check.sh
for
svrhost
in
serverhost
:
host
=
svrhost
.
strip
()
#
##
ssh 접속, 명령어 실행,접속종료
# ssh 접속, 명령어 실행,접속종료
ssh
=
paramiko
.
SSHClient
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
ssh
.
connect
(
host
,
username
=
username
,
password
=
'
%
s'
%
(
password
))
ssh
.
connect
(
host
,
username
=
username
,
password
=
'
%
s'
%
(
password
))
ssh
.
exec_command
(
'sudo ./Seocho_uxen_check.sh >
%
s'
%
(
host
))
ssh
.
close
()
print
(
"
%
s check.sh excution"
%
(
host
))
print
(
"
%
s check.sh excution"
%
(
host
))
#
##
sftp 접속
transport
=
paramiko
.
Transport
((
host
,
port
))
# sftp 접속
transport
=
paramiko
.
Transport
((
host
,
port
))
transport
.
connect
(
username
=
username
,
password
=
password
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
transport
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
transport
)
#
##
인자값 비교해서 달라질때 까지 반복
# 인자값 비교해서 달라질때 까지 반복
while
fac
==
fac2
:
time
.
sleep
(
1
)
filepath
=
(
'/home/orchard/factor'
)
localpath
=
(
'/home/orchard/CSCS/MgmtPM/CMSmgmt/factor'
)
sftp
.
get
(
filepath
,
localpath
)
fac
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
#
##
인자값이 달라지면 실행할 sftp
filepath
=
(
'/home/orchard/
%
s'
%
(
host
))
localpath
=
(
'/home/orchard/result/
%
s'
%
(
host
))
sftp
.
get
(
filepath
,
localpath
)
sftp
.
get
(
filepath
,
localpath
)
fac
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
# 인자값이 달라지면 실행할 sftp
filepath
=
(
'/home/orchard/
%
s'
%
(
host
))
localpath
=
(
'/home/orchard/result/
%
s'
%
(
host
))
sftp
.
get
(
filepath
,
localpath
)
print
(
"
%
s Successful copy"
%
host
)
#
##
인자값 초기화
# 인자값 초기화
os
.
system
(
'sed -i "s/1/0/" factor'
)
filepath
=
(
'/home/orchard/factor'
)
localpath
=
(
'/home/orchard/CSCS/MgmtPM/CMSmgmt/factor'
)
sftp
.
put
(
localpath
,
filepath
)
fac
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
sftp
.
put
(
localpath
,
filepath
)
fac
=
subprocess
.
check_output
(
'cat factor'
,
shell
=
True
)
#
##
sftp 접속종료
# sftp 접속종료
sftp
.
close
()
transport
.
close
()
MgmtPM/CMSmgmt/cms_serverlist.txt
View file @
d048b868
...
...
@@ -17,3 +17,9 @@ web-p-pm04
web-p-pm05
web-t-pm01
web-t-pm02
gads-p-pm01
gads-p-pm02
gads-p-pm03
gads-p-pm04
gads-p-pm05
gads-t-pm01
MgmtPM/CMSmgmt/updateSH_cms.py
View file @
d048b868
...
...
@@ -3,49 +3,46 @@
import
paramiko
import
getpass
#
##
read serverlists
# read serverlists
serverlist
=
open
(
"cms_serverlist.txt"
,
'r'
)
serverhost
=
serverlist
.
readlines
()
#
##
input password
password
=
getpass
.
getpass
(
"orchard password :"
)
# input password
password
=
getpass
.
getpass
(
"orchard password :"
)
#
##
static value
# static value
username
=
"orchard"
port
=
22
#
##
update check.sh
# update check.sh
for
svrhost
in
serverhost
:
host
=
svrhost
.
strip
()
transport
=
paramiko
.
Transport
((
host
,
port
))
transport
=
paramiko
.
Transport
((
host
,
port
))
transport
.
connect
(
username
=
username
,
password
=
password
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
transport
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
transport
)
filepath
=
'/home/orchard/Seocho_uxen_check.sh'
localpath
=
'/home/orchard/CSCS/GuestPM/Integration/Seocho_uxen_check.sh'
sftp
.
put
(
localpath
,
filepath
)
sftp
.
put
(
localpath
,
filepath
)
filepath
=
'/home/orchard/factor'
localpath
=
'/home/orchard/CSCS/MgmtPM/CMSmgmt/factor'
sftp
.
put
(
localpath
,
filepath
)
sftp
.
put
(
localpath
,
filepath
)
sftp
.
close
()
transport
.
close
()
ssh
=
paramiko
.
SSHClient
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
ssh
.
connect
(
host
,
username
=
username
,
password
=
'
%
s'
%
(
password
))
ssh
.
connect
(
host
,
username
=
username
,
password
=
'
%
s'
%
(
password
))
ssh
.
exec_command
(
'sudo chmod 700 /home/orchard/Seocho_uxen_check.sh'
)
ssh
.
close
()
ssh
.
close
()
print
(
"
%
s Successful updates"
%
host
)
jajapi
@youngbin
commented
Jan 28, 2019
Master
python file pep8 코딩 스타일 적용
python file pep8 코딩 스타일 적용
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment