Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos.package
Commits
719d2452
Commit
719d2452
authored
Sep 14, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new way to call slapgrid-ur in cron
parent
9665ec5e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
34 deletions
+36
-34
slapos-node/slaptest
slapos-node/slaptest
+31
-32
slapos-node/template/slapos-node.cron.d
slapos-node/template/slapos-node.cron.d
+1
-1
templates/debian/cron.d
templates/debian/cron.d
+4
-1
No files found.
slapos-node/slaptest
View file @
719d2452
...
@@ -274,23 +274,22 @@ class CronFile:
...
@@ -274,23 +274,22 @@ class CronFile:
# cron file from slapos documentation
# cron file from slapos documentation
self
.
slapgrid_sr_base
=
"""*/5 * * * * root /opt/slapos/bin/slapgrid-sr --logfile=/opt/slapos/slapgrid-sr.log --pidfile=/opt/slapos/slapgrid-sr.pid /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapgrid-sr.log 2>&1"""
self
.
slapgrid_sr_base
=
"""*/5 * * * * root /opt/slapos/bin/slapgrid-sr --logfile=/opt/slapos/slapgrid-sr.log --pidfile=/opt/slapos/slapgrid-sr.pid /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapgrid-sr.log 2>&1"""
self
.
slapgrid_cp_base
=
"""*/5 * * * * root /opt/slapos/bin/slapgrid-cp --logfile=/opt/slapos/slapgrid-cp.log --pidfile=/opt/slapos/slapgrid-cp.pid /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapgrid-cp.log 2>&1"""
self
.
slapgrid_cp_base
=
"""*/5 * * * * root /opt/slapos/bin/slapgrid-cp --logfile=/opt/slapos/slapgrid-cp.log --pidfile=/opt/slapos/slapgrid-cp.pid /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapgrid-cp.log 2>&1"""
self
.
slapgrid_ur_base
=
"""0 0 * * * root
/opt/slapos/bin/slapgrid-ur --logfile=/opt/slapos/slapgrid-ur.log --pidfile=/opt/slapos/slapgrid-ur.pid /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapgrid-ur.log 2>&1
"""
self
.
slapgrid_ur_base
=
"""0 0 * * * root
i=20; false; while [ $? != 0 ]; do /opt/slapos/bin/slapgrid-ur --verbose --logfile=/opt/slapos/slapgrid-ur.log --pidfile=/opt/slapos/slapgrid-ur.pid /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapgrid-ur.log 2>&1; sleep $(($i*60)); if [ $i < 20 ]; then let i++; fi; done;
"""
self
.
slapformat_base
=
"""0 0 * * * root /opt/slapos/bin/slapformat --log_file=/opt/slapos/slapformat.log -c /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapformat.log 2>&1"""
self
.
slapformat_base
=
"""0 0 * * * root /opt/slapos/bin/slapformat --log_file=/opt/slapos/slapformat.log -c /etc/opt/slapos/slapos.cfg >> /opt/slapos/slapformat.log 2>&1"""
def
parse
(
self
,
cron_line
):
def
parse
(
self
,
cron_line
):
""" Parse cron line and give value to attributes """
""" Parse cron line and give value to attributes """
line
=
cron_line
.
split
()
line
=
cron_line
.
split
()
command
=
line
[
6
]
if
"slapformat"
in
cron_line
:
if
"slapformat"
in
command
:
self
.
slapformat
=
self
.
compare
(
self
.
slapformat
,
self
.
slapformat
=
self
.
compare
(
self
.
slapformat
,
self
.
slapformat_base
.
split
()
,
line
)
self
.
slapformat_base
.
split
()
,
line
)
if
"slapgrid-ur"
in
c
ommand
:
if
"slapgrid-ur"
in
c
ron_line
:
self
.
slapgrid_ur
=
self
.
compare
(
self
.
slapgrid_ur
,
self
.
slapgrid_ur
=
self
.
compare
(
self
.
slapgrid_ur
,
self
.
slapgrid_ur_base
.
split
()
,
line
)
self
.
slapgrid_ur_base
.
split
()
,
line
)
if
"slapgrid-cp"
in
c
ommand
:
if
"slapgrid-cp"
in
c
ron_line
:
self
.
slapgrid_cp
=
self
.
compare
(
self
.
slapgrid_cp
,
self
.
slapgrid_cp
=
self
.
compare
(
self
.
slapgrid_cp
,
self
.
slapgrid_cp_base
.
split
()
,
line
)
self
.
slapgrid_cp_base
.
split
()
,
line
)
if
"slapgrid-sr"
in
c
ommand
:
if
"slapgrid-sr"
in
c
ron_line
:
self
.
slapgrid_sr
=
self
.
compare
(
self
.
slapgrid_sr
,
self
.
slapgrid_sr
=
self
.
compare
(
self
.
slapgrid_sr
,
self
.
slapgrid_sr_base
.
split
()
,
line
)
self
.
slapgrid_sr_base
.
split
()
,
line
)
...
@@ -300,7 +299,7 @@ class CronFile:
...
@@ -300,7 +299,7 @@ class CronFile:
for
i
in
range
(
0
,
6
):
for
i
in
range
(
0
,
6
):
if
not
reference
[
i
]
==
cron_line
[
i
]
:
if
not
reference
[
i
]
==
cron_line
[
i
]
:
return
0
return
0
ref
=
len
(
reference
[
6
:]
)
ref
=
len
(
set
(
reference
[
6
:])
)
if
not
len
(
set
(
reference
[
6
:])
&
set
(
cron_line
[
6
:]))
==
ref
:
if
not
len
(
set
(
reference
[
6
:])
&
set
(
cron_line
[
6
:]))
==
ref
:
return
0
return
0
else
:
return
1
else
:
return
1
...
...
slapos-node/template/slapos-node.cron.d
View file @
719d2452
...
@@ -6,7 +6,7 @@ MAILTO=root
...
@@ -6,7 +6,7 @@ MAILTO=root
*/
5
*
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
cp
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
cp
.
log
2
>&
1
*/
5
*
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
cp
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
cp
.
log
2
>&
1
#
slapgrid
-
ur
:
hardcoded
script
to
rerun
slapgrid
-
ur
if
failed
.
#
slapgrid
-
ur
:
hardcoded
script
to
rerun
slapgrid
-
ur
if
failed
.
*
*
*
*
*
root
i
=
20
;
false
;
while
[
$?
!=
0
];
do
/
opt
/
slapos
/
bin
/
slapgrid
-
ur
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
ur
.
log
2
>&
1
;
sleep
$(($
i
*
60
));
if
[
$
i
<
20
];
then
let
i
++;
fi
;
done
;
0
0
*
*
*
root
i
=
20
;
false
;
while
[
$?
!=
0
];
do
/
opt
/
slapos
/
bin
/
slapgrid
-
ur
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
ur
.
log
2
>&
1
;
sleep
$(($
i
*
60
));
if
[
$
i
<
20
];
then
let
i
++;
fi
;
done
;
0
0
*
*
*
root
/
opt
/
slapos
/
bin
/
slapformat
--
verbose
--
log_file
=/
opt
/
slapos
/
slapformat
.
log
-
c
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapformat
.
log
2
>&
1
0
0
*
*
*
root
/
opt
/
slapos
/
bin
/
slapformat
--
verbose
--
log_file
=/
opt
/
slapos
/
slapformat
.
log
-
c
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapformat
.
log
2
>&
1
...
...
templates/debian/cron.d
View file @
719d2452
...
@@ -4,7 +4,10 @@ MAILTO=root
...
@@ -4,7 +4,10 @@ MAILTO=root
*/
5
*
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
sr
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
sr
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
sr
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
sr
.
log
2
>&
1
*/
5
*
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
sr
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
sr
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
sr
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
sr
.
log
2
>&
1
*/
5
*
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
cp
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
cp
.
log
2
>&
1
*/
5
*
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
cp
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
cp
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
cp
.
log
2
>&
1
0
0
*
*
*
root
/
opt
/
slapos
/
bin
/
slapgrid
-
ur
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
ur
.
log
2
>&
1
#
slapgrid
-
ur
:
hardcoded
script
to
rerun
slapgrid
-
ur
if
failed
.
0
0
*
*
*
root
i
=
20
;
false
;
while
[
$?
!=
0
];
do
/
opt
/
slapos
/
bin
/
slapgrid
-
ur
--
verbose
--
logfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
log
--
pidfile
=/
opt
/
slapos
/
slapgrid
-
ur
.
pid
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapgrid
-
ur
.
log
2
>&
1
;
sleep
$(($
i
*
60
));
if
[
$
i
<
20
];
then
let
i
++;
fi
;
done
;
0
0
*
*
*
root
/
opt
/
slapos
/
bin
/
slapformat
--
verbose
--
log_file
=/
opt
/
slapos
/
slapformat
.
log
-
c
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapformat
.
log
2
>&
1
0
0
*
*
*
root
/
opt
/
slapos
/
bin
/
slapformat
--
verbose
--
log_file
=/
opt
/
slapos
/
slapformat
.
log
-
c
/
etc
/
opt
/
slapos
/
slapos
.
cfg
>>
/
opt
/
slapos
/
slapformat
.
log
2
>&
1
0
/
10
*
*
*
*
root
if
[
-
f
/
etc
/
opt
/
slapos
/
openvpn
-
needed
];
then
ifconfig
tapVPN
|
grep
"Scope:Global"
>
/
dev
/
null
;
if
[
$?
=
0
];
then
ROUTES
=$(
ip
-
6
r
l
|
grep
default
|
awk
'
{
print
$
5
}
'
);
for
GW
in
$
ROUTES
;
do
if
[
!
$
GW
=
tapVPN
];
then
/
sbin
/
ip
-
6
route
del
default
dev
$
GW
;
fi
;
done
;
fi
;
fi
0
/
10
*
*
*
*
root
if
[
-
f
/
etc
/
opt
/
slapos
/
openvpn
-
needed
];
then
ifconfig
tapVPN
|
grep
"Scope:Global"
>
/
dev
/
null
;
if
[
$?
=
0
];
then
ROUTES
=$(
ip
-
6
r
l
|
grep
default
|
awk
'
{
print
$
5
}
'
);
for
GW
in
$
ROUTES
;
do
if
[
!
$
GW
=
tapVPN
];
then
/
sbin
/
ip
-
6
route
del
default
dev
$
GW
;
fi
;
done
;
fi
;
fi
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