Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
OpenEdx
ansible
Commits
3705f419
Commit
3705f419
authored
Oct 31, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4754 from mscherer/fix_4648
Fix 4648, cron module is not working on solaris
parents
8b2cd641
9e7b02aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
library/system/cron
+16
-15
No files found.
library/system/cron
View file @
3705f419
...
@@ -144,6 +144,7 @@ EXAMPLES = '''
...
@@ -144,6 +144,7 @@ EXAMPLES = '''
import
os
import
os
import
re
import
re
import
tempfile
import
tempfile
import
platform
CRONCMD
=
"/usr/bin/crontab"
CRONCMD
=
"/usr/bin/crontab"
...
@@ -341,31 +342,31 @@ class CronTab(object):
...
@@ -341,31 +342,31 @@ class CronTab(object):
result
+=
'
\n
'
result
+=
'
\n
'
return
result
return
result
def
_read_file_execute
(
self
):
"""
Returns the command line for reading a crontab
"""
return
"
%
s -l
%
s"
%
(
CRONCMD
,
self
.
_user_execute
())
def
_read_user_execute
(
self
):
def
_read_user_execute
(
self
):
"""
"""
Returns the command line for reading a crontab
Returns the command line for reading a crontab
"""
"""
return
"
%
s -l
%
s"
%
(
CRONCMD
,
self
.
_user_execute
())
user
=
''
if
self
.
user
:
if
platform
.
system
()
==
'SunOS'
:
return
"su '
%
s' -c '
%
s -l'"
%
(
self
.
user
,
CRONCMD
)
else
:
user
=
'-u
%
s'
%
self
.
user
return
"
%
s
%
s
%
s"
%
(
CRONCMD
,
user
,
'-l'
)
def
_write_execute
(
self
,
path
):
def
_write_execute
(
self
,
path
):
"""
"""
Return the command line for writing a crontab
Return the command line for writing a crontab
"""
"""
return
"
%
s
%
s
%
s"
%
(
CRONCMD
,
self
.
_user_execute
(),
path
)
user
=
''
def
_user_execute
(
self
):
"""
User command switches to append to the read and write commands.
"""
if
self
.
user
:
if
self
.
user
:
return
"
%
s
%
s"
%
(
'-u'
,
str
(
self
.
user
))
if
platform
.
system
()
==
'SunOS'
:
return
''
return
"chown
%
s
%
s ; su '
%
s' -c '
%
s
%
s'"
%
(
self
.
user
,
path
,
self
.
user
,
CRONCMD
,
path
)
else
:
user
=
'-u
%
s'
%
self
.
user
return
"
%
s
%
s
%
s"
%
(
CRONCMD
,
user
,
path
)
#==================================================
#==================================================
...
...
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