472,958 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

still get a <defunct> using a python script in the crontab

H!

I have made a program that is checking if a program is running or not.
If the program is not running then it must start the program again.

in the /etc/crontab:
* * * * * root /usr/sbin/
program_prgchk

in the /usr/sbin/program_prgchk:
/usr/local/bin/python /home/reseller/domeinaanvraag/program_prgchk.py
in the program_prgchk.py:
----------------------------------------
import string
import os
import commands

def checkifrunning():
line = string.strip(commands.getoutput("ps x -o pid,command | grep
program_reseller.py | grep -v 'grep'"))
pid = string.split(line,' ')[0]
if pid<>'':pid = int(pid)
return pid

if checkifrunning()=='':
os.system('/usr/sbin/program_reseller')
# os.wait()
# os.waitpid(checkifrunning(),0)

os._exit(0)
If I run the command /usr/sbin/program_prgchk everything works (no
<defunctprocess)
But when I use it in the crontab I get a <defunctprocess

Thanks for helping,
GC-Martijn

Sep 19 '07 #1
2 3843
If I run the command /usr/sbin/program_prgchk everything works (no
<defunctprocess)
But when I use it in the crontab I get a <defunctprocess
The crontabs file on my system is stored in /var/spool/cron/
crontabs/. It appears you are checking the wrong file. Try a
"crontab -e" from the command line and compare it to the contents in
the /etc/crontab file.

Sep 19 '07 #2
On 19 sep, 16:50, Zentrader <zentrad...@gmail.comwrote:
If I run the command /usr/sbin/program_prgchk everything works (no
<defunctprocess)
But when I use it in the crontab I get a <defunctprocess

The crontabs file on my system is stored in /var/spool/cron/
crontabs/. It appears you are checking the wrong file. Try a
"crontab -e" from the command line and compare it to the contents in
the /etc/crontab file.
The crontab is working because I can see that he started the
os.system('/usr/sbin/program_reseller') AND a <defunctprocess (what
I can only kill by killing the '/usr/sbin/program_reseller'

Sep 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the...
3
by: Gerard Oberle | last post by:
The following Perl script print ((time/86400) % 4), " foo foo foo foo\n"; print "bar\n"; produces the output 0bar What happened to " foo foo foo foo\n"?
6
by: Eric Enright | last post by:
Could someone please tell me why this code doesn't work? ----- begin "line.pl" ----- #!/usr/bin/perl # output i'm expecting: # #-----begin----- #foreach $outerline (<FIN>) #{
3
by: Kelvin | last post by:
Basically, my texts consists of normal text stream and some quotations. This is my text stream, and inside "this streams" there are some "quotation pairs" which are to be replaced like this:...
5
by: Bob MacBob | last post by:
Hi all, I have two scripts: 1/ parser.pl which parses a text file and stuffs the relevant data into a mySQL DB - works fine no probs there 2/ importer.pl which I want to run through all the...
15
by: bugzilla | last post by:
hi,all, I have a C++ program need to convert to c language to be used in a emabedded system. the problem is that the original code was writtern in C++ language with Parent class and some child...
8
by: Old VB6 Guy | last post by:
First of all, sorry if crossposting bothers you -- I don't normally do it, but both of these groups seem relavant to my questions. Alright, the time has finally come to make an investment in time...
45
by: n.estner | last post by:
Having read previous discussions on python-dev I think I'm not the only Python programmer who doesn't particularly like python's "self" parameter: class Foo: def bar(self, a,b): return a+b...
3
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/td-position.html In Internet Explorer, the "hello, world!" text is on top on the red box is on the bottom. In Firefox, the "hello, world!" text is on...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.