473,396 Members | 1,917 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,396 software developers and data experts.

running a script like a daemon

Hi there.
I would like to know how to launch a script from the command line (like via
telnet) with the ability to exit the command line without stopping the
thead.
Afterwards I would like to be able to retrieve the id of the thread to kill
it.
I know this is not really Python related since I have had the problem with
Java already ( before my conversion to Python)... but, any idea would be
appreciated.

Thanks :)

Jul 18 '05 #1
3 2880
ivan le magnifique wrote:
I would like to know how to launch a script from the command line (like
via telnet) with the ability to exit the command line without stopping the
thead.
Afterwards I would like to be able to retrieve the id of the thread to
kill it.
I know this is not really Python related since I have had the problem with
Java already ( before my conversion to Python)... but, any idea would be
appreciated.


http://aspn.activestate.com/ASPN/Coo...n/Recipe/66012

To write the daemon's pid to a suitable file (you wrote thread, but that
makes no sense -- I assume you mean process...?!), see os.getpid.
Alex

Jul 18 '05 #2
many thanks !
Jul 18 '05 #3
In most flavors of Unix, you can append the '&' character to the command,
which causes it to execute as a background process, and prepend 'nohup' to
it, which I think makes it continue even if you log off. I'm not a Unix
expert, so my explanation may be flawed, but this is what works for me:
nohup command &

Jp
"ivan le magnifique" <sq**********@free.fr> wrote in message
news:3f*********************@news.free.fr...
Hi there.
I would like to know how to launch a script from the command line (like via telnet) with the ability to exit the command line without stopping the
thead.
Afterwards I would like to be able to retrieve the id of the thread to kill it.
I know this is not really Python related since I have had the problem with
Java already ( before my conversion to Python)... but, any idea would be
appreciated.

Thanks :)

Jul 18 '05 #4

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

Similar topics

8
by: Bob Bedford | last post by:
I've a script that must "launch" an other script on some situations. firstscript.php: .... If ($newarticle) //launch secondscript.php .... The "secondscript.php" may take quite long, and is...
7
by: Spidah | last post by:
Please forgive me if this has been asked before. Is it possible to have a php script run automatically? I am talking about the sort of script that handles regular activities such as issuing...
7
by: Scott Chapman | last post by:
Hi! I'd like a "file" on the Linux box to actually be the input and output of a Python script. Anything written to the file would be sent to a database and anything read from the file would...
7
by: Michael Ransburg | last post by:
Hi! I have implemented a daemon in C++. It runs all the time, between reboots. Is there a way for other C++ classes to get a reference to the instance of this daemon class in order to call its...
1
by: Gregory Stone | last post by:
Is there a way from C++ to essentailly use postgresql as an embedded database? I have a situation where I'd rather have a postgrtes daemon running on my customer's machine except when my client...
1
by: Stefan Neumann | last post by:
I have written a daemon which should run endlessly. The structure looks like this: - start-stop-daemon forks my python program then: if __name__=="__main__": try: main()
8
by: Bernard Lebel | last post by:
Hello, I would like to know if there is a way to run a Python file under a different user account than the one logged in. Allow me to explain. There are a bunch of people here, they are "basic...
3
shahjapan
by: shahjapan | last post by:
Hello, I want to start a server at the linux system boot up (UBUNTU 7.04 ) I have used start-stop-daemon command in my shell script for that. I have written my shell script path in...
2
by: Michael Palmer | last post by:
On Sep 5, 9:56 pm, Sean Davis <seand...@gmail.comwrote: xmlrpc is the right idea, as it interfaces easily across languages.
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:
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.