Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
ac926b5f
Commit
ac926b5f
authored
Nov 02, 2014
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加进程pid
parent
44166e26
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
jumpserver.py
jumpserver.py
+3
-2
models.py
webroot/AutoSa/UserManage/models.py
+4
-0
No files found.
jumpserver.py
View file @
ac926b5f
...
...
@@ -22,7 +22,7 @@ cur_dir = os.path.dirname(__file__)
sys
.
path
.
append
(
'
%
s/webroot/AutoSa/'
%
cur_dir
)
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
'AutoSa.settings'
from
UserManage.models
import
User
,
Logs
from
UserManage.models
import
User
,
Logs
,
Pid
from
Assets.models
import
Assets
...
...
@@ -123,7 +123,6 @@ def connect(host, port, user, password):
datetime_start
=
time
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
,
structtime_start
)
logtime_start
=
time
.
strftime
(
'
%
Y/
%
m/
%
d
%
H:
%
M:
%
S'
,
structtime_start
)
timestamp_start
=
int
(
time
.
mktime
(
structtime_start
))
logfile_name
=
"
%
s/
%
s_
%
s_
%
s"
%
(
log_date_dir
,
host
,
user
,
datetime_start
)
logfile
=
open
(
logfile_name
,
'a'
)
log
=
Logs
(
user
=
user
,
host
=
host
,
logfile
=
logfile_name
,
start_time
=
timestamp_start
)
...
...
@@ -136,6 +135,8 @@ def connect(host, port, user, password):
foo
.
logfile
=
logfile
foo
.
sendline
(
''
)
signal
.
signal
(
signal
.
SIGWINCH
,
sigwinch_passthrough
)
pid
=
Pid
(
pid
=
os
.
getpid
())
pid
.
save
()
foo
.
interact
(
escape_character
=
chr
(
28
))
logfile
.
write
(
'
\n
%
s'
%
time
.
strftime
(
'
%
Y/
%
m/
%
d
%
H:
%
M:
%
S'
))
log
.
finish
=
1
...
...
webroot/AutoSa/UserManage/models.py
View file @
ac926b5f
...
...
@@ -35,4 +35,8 @@ class Logs(models.Model):
return
self
.
logfile
class
Pid
(
models
.
Model
):
pid
=
models
.
IntegerField
()
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