Re: Linux : create a user if not exists

2011-08-16 Thread smain kahlouch
Ok than you. You're right but it doesn't help me : I replaced it : >>> def finduser(user): ... if pwd.getpwnam(user): ... print user, "user exists" ... return True ... return False ... >>> finduser('realuser') realuser user exists True >>> finduser('blabla') Traceba

Re: Application monitoring

2011-08-16 Thread smain kahlouch
or shinken ( written in python :) ); Regards, Sam 2011/8/16 Nitin Pawar > We use nagios for such monitoring > > > On Tue, Aug 16, 2011 at 4:47 PM, Abhishek Bajpai wrote: > >> I need to monitor applications like apache, mysql etc there live >> status, errors etc on my LAN is there any tool or li

Linux : create a user if not exists

2011-08-16 Thread smain kahlouch
Hi all, I'm learning the python language and i'm trying to create a user if it is not found in the system. I figured it out by doing the following thing : >>> def finduser(user): ... for line in open('/etc/passwd'): ... if line.startswith(user): ... print user,