Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How can I interrupt os.system(cmd)?

Reply
Thread Tools

How can I interrupt os.system(cmd)?

 
 
Carl
Guest
Posts: n/a
 
      11-21-2004
Dear friends,

I have written a small Python program that executes "cmd" via
os.system(cmd).

My problem is that "cmd" runs on forever.

More specifically, I want to run "cmd" for one hour on a regular day-to-day
basis by using crontab as a scheduler.

What options do I have to control execution of external programs from
Python?

Carl

 
Reply With Quote
 
 
 
 
Mathias Waack
Guest
Posts: n/a
 
      11-21-2004
Carl wrote:
> What options do I have to control execution of external programs
> from Python?


You have the same options as your OS offers. At least under Unix you
can run a command by using one of the popen()-functions or using the
commands module (I would suggest the latter for you). All these
procedures give you the process id (pid) of the started process. You
can wait() for this process or you can control it by sending it
signals using the kill() function. The python docs contains all
information necessary to use these functions. Read the pages about
the modules os, popen and commands. Most of these functions should
be available under all OS.

Mathias
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How can server interrupt client in browser? Anil Javascript 9 11-12-2008 02:10 AM
Is any function which can associate the irqno with interrupt handl mani C Programming 3 11-18-2007 03:43 AM
cant interrupt sub program call ERROR!!!! for conversion. prabhu VHDL 1 02-25-2004 03:32 PM
where can i find the core code of intel 8259A interrupt controller? Tony VHDL 0 11-13-2003 09:21 AM



Advertisments