Re: [Tutor] Help with daemon

2005-04-28 Thread Max Noel
On Apr 28, 2005, at 23:06, Alberto Troiano wrote:
I tried:
import os
os.system("ps --user root")
and I get
0
as a return
How can I get the PID and bind the command above with a variable?? I 
mean
varusername="root"
os.system("ps --user varusername")
works???
	So in essence, what you're trying to do is store the output of a 
command in a variable, right?
	You might be interested in the os.popen family of functions.

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with daemon

2005-04-28 Thread Alberto Troiano
Hi
I will make it with CRON. Thanks Max for the idea
Now I have another problem
How can I kill a process???
I know that if I run ps --user username it returns all the process started 
by username even the PIDs and with kill -9 PID I destroy the process but I 
don't know how to execute it from Python

I tried:
import os
os.system("ps --user root")
and I get
0
as a return
How can I get the PID and bind the command above with a variable?? I mean
varusername="root"
os.system("ps --user varusername")
works???
thanks in advanced
Alberto
From: Max Noel <[EMAIL PROTECTED]>
To: "Alberto Troiano" <[EMAIL PROTECTED]>
CC: tutor@python.org
Subject: Re: [Tutor] Help with daemon
Date: Wed, 27 Apr 2005 23:38:00 +0100
On Apr 27, 2005, at 22:35, Alberto Troiano wrote:
I'm gonna give you an example:
The program will check for new users and to check record time every 10 
seconds. But first the program will have to finish the checking process 
that started before so it won't be 10 seconds right?
Unless I have one process for each user to check the database at the same 
time is checking other users
	This sounds like it'd be better done as a cron job (man cron for more 
info).

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting and 
sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Gaucho
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with daemon

2005-04-27 Thread Max Noel
On Apr 27, 2005, at 22:35, Alberto Troiano wrote:
I'm gonna give you an example:
The program will check for new users and to check record time every 10 
seconds. But first the program will have to finish the checking 
process that started before so it won't be 10 seconds right?
Unless I have one process for each user to check the database at the 
same time is checking other users
	This sounds like it'd be better done as a cron job (man cron for more 
info).

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor