Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unstable
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PROINFODATA
unstable
Commits
8d35db8b
Commit
8d35db8b
authored
11 years ago
by
Diego Giovane Pasqualin
Browse files
Options
Downloads
Plain Diff
Merge branch 'elapsed-time' of /home/git/repositories/proinfodata/unstable
parents
35376001
fa61f607
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
windows-collect/src/proinfodataAgent.py
+27
-1
27 additions, 1 deletion
windows-collect/src/proinfodataAgent.py
with
27 additions
and
1 deletion
windows-collect/src/proinfodataAgent.py
+
27
−
1
View file @
8d35db8b
...
...
@@ -25,7 +25,7 @@ import _winreg
import
shutil
import
subprocess
import
urllib
from
time
import
localtime
,
strftime
from
time
import
localtime
,
strftime
,
time
from
xml.etree.ElementTree
import
tostring
import
collect
import
glob
...
...
@@ -37,6 +37,7 @@ import glob
PROINFODATAPATH
=
os
.
environ
[
"
ProgramFiles
"
]
+
"
\\
ProInfoData
"
PREVIOUSPATH
=
PROINFODATAPATH
+
"
\\
data
\\
previous
"
URL
=
"
http://200.17.202.187/tomcat/axis/Seed2.jws
"
LASTEXEC
=
PROINFODATAPATH
+
"
\\
data
\\
lastexec.txt
"
# Log lifetime in days
LOGLIFETIME
=
30
...
...
@@ -189,6 +190,19 @@ def callUpdater():
# Wait to be killed
out
=
proc
.
communicate
()
# Check if have passed 24 hours since the last sucessful execution
def
elapsedTime
():
if
not
os
.
path
.
exists
(
LASTEXEC
):
return
True
lastexec
=
file
(
LASTEXEC
,
"
r
"
).
read
()
# 86400 seconds = 24 hours
if
time
()
-
float
(
lastexec
)
>
86400
:
return
True
else
:
return
False
# ==========================================
# Main program
# ==========================================
...
...
@@ -271,6 +285,13 @@ if(updatelink):
else
:
log
.
write
(
"
UPDATE: No updates are available.
"
)
# Check if have passed 24 hours since the last sucessful execution
if
not
elapsedTime
():
# If everything ran ok, exit with success status
log
.
write
(
"
EXIT(0): Success, not elapsed time.
"
)
log
.
close
()
sys
.
exit
(
0
)
# Collect data
try
:
collectData
=
collect
.
collect
()
...
...
@@ -329,6 +350,11 @@ if os.path.isdir(PREVIOUSPATH):
log
.
close
()
sys
.
exit
(
14
)
# Record the last sucess execution
lastExecFile
=
file
(
LASTEXEC
,
"
w
"
)
lastExecFile
.
write
(
str
(
time
()))
lastExecFile
.
close
()
# If everything ran ok, exit with success status
log
.
write
(
"
EXIT(0): Success.
"
)
log
.
close
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment