LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-06-2013, 01:41 PM   #1
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548

Rep: Reputation: 72
Recommended method to start possible zombie process.


I have a Linux cluster that runs a script that copies a file every time a new node takes over. The copy process itself is simple.

Part of the copy routine is a simple scp process to update a file on the inactive nodes. It needs to break away from the parent script and retry until success. That could take 3 seconds or 30 seconds or 30 days. Die on reboot is the only relevant way to end because the cluster will just move to another node and start it again.

I personally don't care if the process keeps trying to do the scp steps to clean up the inactive nodes as a zombie. Is there a professional method of handling a possibly long-running process like the one I described? FWIW, I will write the script in PERL or Dash.

What I like about this method is this is, in theory, very simple and cluster specific. No syncing crontabs and scripts, cron job tests for active node status, or more complicated configuration management systems.

Last edited by mpapet; 08-06-2013 at 02:00 PM.
 
Old 08-06-2013, 01:54 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I would write that as a program and launch it as a daemon. In fact I wrote a few blog entries about how to create a daemon and manage it, as well as how to clean up zombies.

http://www.linuxquestions.org/questi...ocesses-35540/
http://www.linuxquestions.org/questi...zombies-35575/

To correct your perspective though. Zombies do nothing. They exist merely because the parent which forked them is still around, the former process which became a zombie terminated. In terminating, it sent a signal to the parent process. I believe this is part of the System V closure architecture. If the parent process never checks for that signal, the defunct process remains as a zombie. If the parent process itself exits, then any zombie processes attached to it will be resolved. In the end, the zombie is not an active process, it does nothing except to hold a place in the system. Ultimately they're not good to have.

My recommended architecture would be to write a daemon, run that in the system and use that to perform you timing for when you wish to launch your child process. Once the time, or conditions are correct for launching your intended process, use fork() and exec() to do this, and then have your daemon periodically check for signals from that process to clean up the zombie state.
 
1 members found this post helpful.
Old 08-06-2013, 02:07 PM   #3
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548

Original Poster
Rep: Reputation: 72
rtmistler,

Thanks for the reply. Zombie is not the right term. I just need the script to start a new process then exit leaving that process running.

I don't NEED to control the process, but a daemon the more professional way to do it.

Based on your reply, I found this handy package to do the work for me! http://packages.debian.org/wheezy/daemon Very nice features.

Last edited by mpapet; 08-06-2013 at 02:20 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] zombie process yashfire007 Linux - Newbie 2 04-05-2013 10:11 AM
Recommended method of installing fastcgi? chessonly Red Hat 3 06-06-2012 11:55 AM
Which is a recommended method of partitioning Disk? pinga123 Linux - Newbie 8 04-11-2012 03:44 PM
Zombie process awanish.tiwari Linux - Newbie 5 01-21-2011 12:45 PM
Recommended method to install Gentoo ecuas Linux - Newbie 3 01-08-2007 08:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration