Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ian Eiloart
Sympl
Commits
237a1eca
Commit
237a1eca
authored
Jul 19, 2019
by
Paul Cammish
Browse files
Merge branch 'buster_cron-fix' into 'buster-testing'
Fix output for sympl-crontab See merge request
sympl/sympl!111
parents
ca259cb7
a499fdd0
Changes
2
Show whitespace changes
Inline
Side-by-side
cron/debian/changelog
View file @
237a1eca
sympl-cron (10.0.190719.0) stable; urgency=medium
* Updated sympl-crontab --test output
-- Paul Cammish <sympl@kelduum.net> Fri, 19 Jul 2019 12:07:00 +0100
sympl-cron (10.0.190621.0) stable; urgency=medium
* Created Sympl v10.0 (Debian Buster)
...
...
cron/lib/symbiosis/crontab.rb
View file @
237a1eca
...
...
@@ -31,26 +31,6 @@ require 'net/smtp'
require
'date'
require
'time'
#
# Additional methods for DateTime
#
class
DateTime
#
# Return a string of self in the standard "YYYY-MM-DD hh:mm" format.
#
def
iso8601
"%04i-%02i-%02i %02i:%02i"
%
[
year
,
month
,
day
,
hour
,
min
]
end
#
# Convert self into a Time.
#
def
to_time
Time
.
local
(
year
,
month
,
day
,
hour
,
min
,
sec
)
end
end
module
Symbiosis
#
...
...
@@ -123,19 +103,19 @@ module Symbiosis
#
def
test
(
t
=
Time
.
now
)
cron_env
=
@environment
.
merge
(
ENV
){
|
k
,
o
,
n
|
o
}
puts
"Environment
\n
"
+
"-"
*
7
2
puts
"Environment
\n
"
+
"-"
*
7
9
%w(HOME LOGNAME PATH MAILTO)
.
each
do
|
k
|
puts
"
#{
k
}
=
#{
cron_env
[
k
]
}
"
end
puts
"="
*
7
2
+
"
\n\n
"
puts
"Jobs next due -- Local time
#{
t
.
iso8601
}
\n
"
+
"-"
*
7
2
puts
(
"%-20s"
%
"
Dat
e"
)
+
"Command"
puts
"-"
*
7
2
puts
"="
*
7
9
+
"
\n\n
"
puts
"Jobs next due -- Local time
#{
t
.
strftime
(
'%Y-%m-%d %H:%M:%S'
)
}
\n
"
+
"-"
*
7
9
puts
(
"%-20s"
%
"
Next Run Tim
e"
)
+
"Command"
puts
"-"
*
7
9
@records
.
each
do
|
record
|
n
=
record
.
next_due
(
t
)
puts
(
"%-20s"
%
(
n
.
nil?
?
"** NEVER **"
:
n
.
iso8601
))
+
record
.
command
puts
(
"%-20s"
%
(
n
.
nil?
?
"** NEVER **"
:
n
.
strftime
(
'%Y-%m-%d %H:%M'
)
))
+
record
.
command
end
puts
"="
*
7
2
puts
"="
*
7
9
end
#
...
...
@@ -297,6 +277,7 @@ module Symbiosis
# arguments fail to parse.
#
def
initialize
(
min
,
hour
,
mday
,
mon
,
wday
,
command
)
@min
=
parse_field
(
min
,
0
,
59
)
@hour
=
parse_field
(
hour
,
0
,
23
)
@mday
=
parse_field
(
mday
,
1
,
31
)
...
...
@@ -327,7 +308,6 @@ module Symbiosis
# Returns true if the record should be run at time set by now.
#
def
ready?
(
now
=
Time
.
now
)
now
=
now
.
to_time
if
@lazy_mday_wday_match
min
.
include?
now
.
min
and
hour
.
include?
now
.
hour
and
...
...
@@ -349,8 +329,9 @@ module Symbiosis
# time in the 30 years after now.
#
def
next_due
(
now
=
Time
.
now
)
time
=
now
.
to_time
time
=
now
orig_time
=
time
while
!
ready?
(
time
)
# find the next minute that matches
...
...
@@ -443,9 +424,16 @@ module Symbiosis
break
end
end
# We want the *next* time it'll run, rather than the time right now.
if
ready?
(
orig_time
)
time
+
60
else
time
end
end
#
# Run the command. Returns an arry of strings as output.
...
...
Write
Preview
Supports
Markdown
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