Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
slapos
Commits
b6ba7fd2
Commit
b6ba7fd2
authored
Mar 29, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: check config modification more often
parent
255f61e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
16 deletions
+28
-16
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+1
-1
stack/monitor/scripts/monitor-document.py
stack/monitor/scripts/monitor-document.py
+27
-15
No files found.
stack/monitor/buildout.cfg
View file @
b6ba7fd2
...
@@ -154,7 +154,7 @@ md5sum = cc65aebd4c35b3172a7ca83abde761bc
...
@@ -154,7 +154,7 @@ md5sum = cc65aebd4c35b3172a7ca83abde761bc
[monitor-document-edit]
[monitor-document-edit]
<= monitor-template-script
<= monitor-template-script
filename = monitor-document.py
filename = monitor-document.py
md5sum =
79c53518e53ae8c8487b09bb49bc7b8
0
md5sum =
f3e557e5d81291a22d6d2837a9e37bd
0
[make-rss-script]
[make-rss-script]
...
...
stack/monitor/scripts/monitor-document.py
View file @
b6ba7fd2
...
@@ -7,6 +7,7 @@ import json
...
@@ -7,6 +7,7 @@ import json
import
argparse
import
argparse
import
subprocess
import
subprocess
from
datetime
import
datetime
from
datetime
import
datetime
import
time
def
parseArguments
():
def
parseArguments
():
...
@@ -144,21 +145,32 @@ if __name__ == "__main__":
...
@@ -144,21 +145,32 @@ if __name__ == "__main__":
parser
=
parseArguments
()
parser
=
parseArguments
()
parameter_tmp_file
=
os
.
path
.
join
(
parser
.
config_folder
,
'config.tmp.json'
)
parameter_tmp_file
=
os
.
path
.
join
(
parser
.
config_folder
,
'config.tmp.json'
)
config_file
=
os
.
path
.
join
(
parser
.
config_folder
,
'config.json'
)
config_file
=
os
.
path
.
join
(
parser
.
config_folder
,
'config.json'
)
result_dict
=
applyEditChage
(
parser
)
# Run 4 times with sleep
if
result_dict
!=
{}:
run_counter
=
1
status
=
True
max_runn
=
4
for
key
in
result_dict
:
sleep_time
=
15
if
not
result_dict
[
key
]:
status
=
False
while
True
:
result_dict
=
applyEditChage
(
parser
)
if
status
and
os
.
path
.
exists
(
parameter_tmp_file
):
if
result_dict
!=
{}:
try
:
status
=
True
os
.
unlink
(
config_file
)
for
key
in
result_dict
:
except
OSError
,
e
:
if
not
result_dict
[
key
]:
print
"ERROR cannot remove file: %s"
%
parameter_tmp_file
status
=
False
else
:
os
.
rename
(
parameter_tmp_file
,
config_file
)
if
status
and
os
.
path
.
exists
(
parameter_tmp_file
):
try
:
os
.
unlink
(
config_file
)
except
OSError
,
e
:
print
"ERROR cannot remove file: %s"
%
parameter_tmp_file
else
:
os
.
rename
(
parameter_tmp_file
,
config_file
)
if
run_counter
==
max_runn
:
break
else
:
run_counter
+=
1
time
.
sleep
(
sleep_time
)
...
...
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