473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 3863
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.