Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
pve-manager
Commits
2e368502
Commit
2e368502
authored
Oct 27, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use starttime hh:mm instead of hour and minute
parent
f3854ce6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
32 deletions
+25
-32
Backup.pm
PVE/API2/Backup.pm
+25
-32
No files found.
PVE/API2/Backup.pm
View file @
2e368502
...
...
@@ -59,7 +59,7 @@ sub parse_dow {
$dowstr
=
'
1,2,3,4,5,6,7
'
if
$dowstr
eq
'
*
';
foreach
my
$day
(
split
(
/,/
,
$dowstr
))
{
foreach
my
$day
(
PVE::Tools::
split_list
(
$dowstr
))
{
if
(
$day
=~
m/^(mon|tue|wed|thu|fri|sat|sun)-(mon|tue|wed|thu|fri|sat|sun)$/i
)
{
for
(
my
$i
=
$dowmap
->
{
lc
(
$1
)};
$i
<=
$dowmap
->
{
lc
(
$2
)};
$i
++
)
{
my
$r
=
$rdowmap
->
{
$i
};
...
...
@@ -115,8 +115,7 @@ sub parse_vzdump_cron_config {
$opts
->
{
id
}
=
"
$digest
:
$jid
";
$jid
++
;
$opts
->
{
hour
}
=
$hour
;
$opts
->
{
minute
}
=
$minute
;
$opts
->
{
starttime
}
=
sprintf
"
%02d:%02d
",
$hour
,
$minute
;
$opts
->
{
dow
}
=
&
$dowhash_to_dow
(
$dowhash
);
push
@$jobs
,
$opts
;
...
...
@@ -161,17 +160,27 @@ sub write_vzdump_cron_config {
$dow
=
'
*
'
if
!
$dow
;
}
my
(
$hour
,
$minute
);
die
"
no job start time specified
\n
"
if
!
$job
->
{
starttime
};
if
(
$job
->
{
starttime
}
=~
m/^(\d{1,2}):(\d{1,2})$/
)
{
(
$hour
,
$minute
)
=
(
int
(
$1
),
int
(
$2
));
die
"
hour '
$hour
' out of range
\n
"
if
$hour
<
0
||
$hour
>
23
;
die
"
minute '
$minute
' out of range
\n
"
if
$minute
<
0
||
$minute
>
59
;
}
else
{
die
"
unable to parse job start time
\n
";
}
my
$param
=
"";
foreach
my
$p
(
keys
%
$job
)
{
next
if
$p
eq
'
id
'
||
$p
eq
'
vmid
'
||
$p
eq
'
hour
'
||
$p
eq
'
minute
'
||
$p
eq
'
dow
';
next
if
$p
eq
'
id
'
||
$p
eq
'
vmid
'
||
$p
eq
'
starttime
'
||
$p
eq
'
dow
';
my
$v
=
$job
->
{
$p
};
$param
.=
"
--
$p
"
.
PVE::Tools::
shellquote
(
$v
)
if
defined
(
$v
)
&&
$v
ne
'';
}
$param
.=
"
$job
->{vmid}
"
if
$job
->
{
vmid
};
$out
.=
sprintf
"
$
job
->{minute}
$job
->{hour}
* * %-11s root vzdump
$param
\n
",
$dow
;
$out
.=
sprintf
"
$
minute
$hour
* * %-11s root vzdump
$param
\n
",
$dow
;
}
my
$ejobs
=
$cfg
->
{
ejobs
}
||
[]
;
...
...
@@ -223,19 +232,11 @@ __PACKAGE__->register_method({
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
PVE::VZDump::
json_config_properties
({
hour
=>
{
type
=>
'
integer
',
description
=>
"
Start time (hour).
",
minimum
=>
0
,
maximum
=>
23
,
},
minute
=>
{
type
=>
'
integer
',
optional
=>
1
,
description
=>
"
Start time (minute).
",
minimum
=>
0
,
maximum
=>
59
,
default
=>
0
,
starttime
=>
{
type
=>
'
string
',
description
=>
"
Job Start time.
",
pattern
=>
'
\
d{1,2}:
\
d{1,2}
',
typetext
=>
'
HH:MM
',
},
dow
=>
{
type
=>
'
string
',
format
=>
'
pve-day-of-week-list
',
...
...
@@ -367,19 +368,11 @@ __PACKAGE__->register_method({
description
=>
"
The job ID.
",
maxLength
=>
50
,
},
hour
=>
{
type
=>
'
integer
',
optional
=>
1
,
description
=>
"
Start time (hour).
",
minimum
=>
0
,
maximum
=>
23
,
},
minute
=>
{
type
=>
'
integer
',
optional
=>
1
,
description
=>
"
Start time (minute).
",
minimum
=>
0
,
maximum
=>
59
,
starttime
=>
{
type
=>
'
string
',
description
=>
"
Job Start time.
",
pattern
=>
'
\
d{1,2}:
\
d{1,2}
',
typetext
=>
'
HH:MM
',
},
dow
=>
{
type
=>
'
string
',
format
=>
'
pve-day-of-week-list
',
...
...
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