diff options
-rw-r--r-- | system/cron.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/system/cron.py b/system/cron.py index 8152c6e5..a983a398 100644 --- a/system/cron.py +++ b/system/cron.py @@ -198,6 +198,7 @@ EXAMPLES = ''' ''' import os +import pwd import re import tempfile import platform @@ -477,7 +478,7 @@ class CronTab(object): return "%s -l %s" % (pipes.quote(CRONCMD), pipes.quote(self.user)) elif platform.system() == 'HP-UX': return "%s %s %s" % (CRONCMD , '-l', pipes.quote(self.user)) - elif os.getlogin() != self.user: + elif pwd.getpwuid(os.getuid())[0] != self.user: user = '-u %s' % pipes.quote(self.user) return "%s %s %s" % (CRONCMD , user, '-l') @@ -489,7 +490,7 @@ class CronTab(object): if self.user: if platform.system() in ['SunOS', 'HP-UX', 'AIX']: return "chown %s %s ; su '%s' -c '%s %s'" % (pipes.quote(self.user), pipes.quote(path), pipes.quote(self.user), CRONCMD, pipes.quote(path)) - elif os.getlogin() != self.user: + elif pwd.getpwuid(os.getuid())[0] != self.user: user = '-u %s' % pipes.quote(self.user) return "%s %s %s" % (CRONCMD , user, pipes.quote(path)) |