473,748 Members | 7,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do you return an exit code with out exiting

I wrote a simple python program that scrapes a web page every 30 secons
and dumps the result in a data base. I want to use my linux distros
build in init tools to run the script in the back ground as a daemon.
The problem is when I call the daemon script to background the program I
wrote it just hangs, waiting for my program to exit 1 or 0. My program
never does exits because its looping every 30 seconds.

Is there a way I can pass an exit value with out actualy exiting? or is
there are better way to do this?

Thanks
--
Matthew Thorley
Jul 19 '05 #1
2 1404
On 2005-05-23, Matthew Thorley <ru***@chpc.uta h.edu> wrote:
I wrote a simple python program that scrapes a web page every
30 secons and dumps the result in a data base. I want to use
my linux distros build in init tools to run the script in the
back ground as a daemon. The problem is when I call the daemon
script to background the program I wrote it just hangs,
waiting for my program to exit 1 or 0. My program never does
exits because its looping every 30 seconds.

Is there a way I can pass an exit value with out actualy exiting?
No.
or is there are better way to do this?


Yes.

To be a well-behavied daemon, you need to do the things
described in this howto:

http://www.linuxprofilm.com/articles...mon-howto.html

Here are a couple references on how to do this in Python:

http://aspn.activestate.com/ASPN/Coo.../Recipe/278731
http://homepage.hispeed.ch/py430/python/

--
Grant Edwards grante Yow! Intra-mural sports
at results are filtering
visi.com through th' plumbing...
Jul 19 '05 #2
thanks thats perfect!

Grant Edwards wrote:
On 2005-05-23, Matthew Thorley <ru***@chpc.uta h.edu> wrote:

I wrote a simple python program that scrapes a web page every
30 secons and dumps the result in a data base. I want to use
my linux distros build in init tools to run the script in the
back ground as a daemon. The problem is when I call the daemon
script to background the program I wrote it just hangs,
waiting for my program to exit 1 or 0. My program never does
exits because its looping every 30 seconds.

Is there a way I can pass an exit value with out actualy exiting?

No.

or is there are better way to do this?

Yes.

To be a well-behavied daemon, you need to do the things
described in this howto:

http://www.linuxprofilm.com/articles...mon-howto.html

Here are a couple references on how to do this in Python:

http://aspn.activestate.com/ASPN/Coo.../Recipe/278731
http://homepage.hispeed.ch/py430/python/

Jul 19 '05 #3

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

Similar topics

6
1755
by: Rigga | last post by:
Hi, I am new to Python and am currentky just playing with some simple functions however I can not work out how to return a variable back from a module, probably easier if you see the code.. what I want it to do is to repeat the while loop until it is no longer equal to 'repeat', code is below, go easy on me!: =========================================================================== import sys import os # Check that the folder is...
6
1396
by: RitaG | last post by:
Hi. I have a Sub that calls a Boolean Function and exits the Sub if the Return value is False. The problem is it's exiting the Sub even if the Return value is True. Here's my code. Private MySub If Not DownloadFIIDSFile() Then Exit Sub
2
4305
by: Von Bailey | last post by:
I need a way to disable the Return/Enter key in specific fields or on a given form. The goal is to limit way the user exits field as there is necessary code run when the user exits the field and the Exit Event doesn't seem to recognize exiting via the Return/Enter key but does for the Tab or Arrow keys. So I want to limit the user to using the tab or arrow keys to manuver between fields. I have tried adjusting the...
2
17746
by: steve bull | last post by:
I have built what I think should be a dialog box. It contains 4 tabbed panes for generating a range of colors. Each tabbed pane consists of a panel with all the widgets on them including the OK and Cancel buttons. These buttons have to be on the panels themselves so that they can create the color range from the current settings on the panel and return the result via a delegate to the main dialog form. The problem I have is that the OK...
0
1310
by: Cwappy | last post by:
I have a class that builds a DataTable and then, when the process is exiting, tries to write that DataTable to SQL Server 2000 via the SqlBulkCopy class. I know the process is exiting because I'm catching the ProcessExit event (this is a console app). The problem is that calling WriteToServer as seen below will immediately exit the program WITHOUT generating any exceptions or any other notices, including if I step through the code...
4
2718
by: amatoo04 | last post by:
hi guys, i am trying to finish up a program i started this morning and basically i got the whole input and output down... i just need help with the function which will scan the file and return number of lines, amount of characters, and amount of alphabetical characters. I was wondering if i would need 3 different functions, and how would i go about setting those up. here is my code so far /*Write a program, which scans a file and counts...
2
11865
by: Matuag | last post by:
Hi All, I want to create following command buttons on a Form which users can edit. Save ( Save Changes made) Cancel ( Undo data changes) Exit ( Close form) I am using Macros for each of these commands and they work perfect.
4
34309
by: devi thapa | last post by:
Hi, I am executing a python script in a shell script. The python script actually returns a value. So, can I get the return value in a shell script? If yes, then help me out. Regards, Devi
2
3153
by: Bassem | last post by:
I'm working on simple chat program via serial port. It works fine, but i face this problem. When i try to open the exe, UnauthorizedAccess exception occurs, i can't use COM1 becuase someone else has it. I checked it and found that another copy of the program still work (by task manager). That's mean closing the program will not close the serial port. I tried these : Note: I read it using a separate thread. 1)override OnClose to, close the...
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.