Changeset 1759 for pykota/trunk

Show
Ignore:
Timestamp:
09/30/04 13:22:30 (20 years ago)
Author:
jalet
Message:

Extends the PATH and doesn't use absolute path anymore to launch edpykota.

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/autopykota

    r1758 r1759  
    2424# 
    2525# $Log$ 
     26# Revision 1.2  2004/09/30 11:22:30  jalet 
     27# Extends the PATH and doesn't use absolute path anymore to launch edpykota. 
     28# 
    2629# Revision 1.1  2004/09/30 09:52:45  jalet 
    2730# Initial release of autopykota. Reading help or manpage is greatly 
     
    8083    def main(self, arguments, options) : 
    8184        """Main entry point.""" 
     85        os.environ["PATH"] = "%s:/bin:/usr/bin:/usr/local/bin:/opt/bin" % os.environ.get("PATH", "") 
    8286        username = os.environ.get("PYKOTAUSERNAME") 
    8387        printername = os.environ.get("PYKOTAPRINTERNAME") 
     
    9599                    else :     
    96100                        self.logdebug("User %s already exists. Creating a quota entry for user %s on printer %s." % (username, username, printername)) 
    97                         return os.system('/usr/bin/edpykota --add --printer "%s" "%s"' % (printername, username)) 
     101                        return os.system('edpykota --add --printer "%s" "%s"' % (printername, username)) 
    98102                else : 
    99103                    self.logdebug("User %s already exists. Printer %s doesn't exist. Creating printer %s and a quota entry for user %s on printer %s." % (username, printername, printername, username, printername)) 
    100                     return os.system('/usr/bin/edpykota --add --printer "%s" "%s"' % (printername, username)) 
     104                    return os.system('edpykota --add --printer "%s" "%s"' % (printername, username)) 
    101105            else : 
    102106                if options["initbalance"] is None : 
     
    104108                else : 
    105109                    self.logdebug("User %s doesn't exist yet. Creating user %s's account and quota entries on all existing printers." % (username, username)) 
    106                     return os.system('/usr/bin/edpykota --add --limitby balance --balance "%s" "%s"' % (options["initbalance"], username)) 
     110                    return os.system('edpykota --add --limitby balance --balance "%s" "%s"' % (options["initbalance"], username)) 
    107111     
    108112if __name__ == "__main__" :     
  • pykota/trunk/conf/pykota.conf.sample

    r1757 r1759  
    481481#  
    482482#   policy: external(/usr/bin/edpykota --add --printer %(printername)s --softlimit 50 --hardlimit 60 %(username)s >/dev/null)  
     483# 
     484# NB : If you want to limit users by their account balance value, it is preferable to 
     485# use the following policy to automate user account creation on first print : 
     486# 
     487#   policy: external(/usr/bin/autopykota --initbalance 25.0 >/dev/null)  
     488# 
     489#   This will automatically add the user if he doesn't already exist, and 
     490#   set his initial balance value to 25.0 (for example). If the user already  
     491#   exists then his balance value will not be modified.  
     492#   Please don't use autopykota if you want to limit your users by page 
     493#   quota, and in any case, carefully read autopykota's help or manpage 
     494#   and understand its goal before using it in your own configuration. 
    483495# 
    484496# Of course you can launch any command of your choice with this, e.g. :