Programming :: Gracefully Exit A Background Process?

Jun 7, 2011

I am using a program that reads in data from a serial port and then sends that data out over a TCP connection. The problem I'm having is that the only way I know to exit the program is to do a 'kill PID', but doing this means the program doesn't go through the motions of closing the TCP connection properly so I have to wait some random period of time for the port to free itself or else when I try to start it back up it tells me that it can't bind to the specified port.The general structure of the program is as follows

Code:
int main(){
// initialize some stuff

[code]...

View 1 Replies


ADVERTISEMENT

Programming :: Capturing The Exit Status Of The Script Running In Background

Apr 10, 2010

I have a scenario where I am executing some child shell scripts in background (using &)through a master parent script.

Is there a way I can capture the exit status of each individual child script after the execution is completed.

View 7 Replies View Related

Programming :: Exit My Script W/o Leaving An Orphan Process Running

Dec 4, 2010

It's called TextRipper and it creates indexable and editable text files from any image. Feel free to copy TextRipper; it's licenced under GPL. My troubles are with cracking passworded pdf's. (As you can see, I meant any when I said any image.)

I can't find a way for the user to cancel the decryption process by exiting the script without pdfcrack orphaning. Line 349 works the rest of the time; the concerned process is line 228. I believe it's a piping/subshell problem. At least that's how I've been going at it in vain.

I've made portability a priority and that the comments still require updating.

Code:

If the result is one output file, TextRipper will open it for you in OpenOffice Writer.

Otherwise all txt output files (editable and indexable) will be in the original file's directory." 0 0

View 14 Replies View Related

Programming :: Physical Memory Leaked By User Application Process Is Not Reclaimed Back After Exit?

May 2, 2010

Whenever I'm running my application process, I've 1M physical memory usage is increasing for every 2 hours.This I observed using 'free -m' command.But 'top' command did not showing any increase 'RSS' size.It is same as it was started initially.Even though I stopped my process,the increased memory was not released back. If I start my application process then again memory usage start increasing by 1M for every 2 hours. increase of memory usage observer with 'free' and that too when my application is running, but top command is not showing any change in the RSS sizeIf my application is leaking any memory which is allocated by new/malloc, that should be released back whenever my application exit and the size increase will be show through top command for that process, right? This is not happeningThis proves that there is no potential leaks in my process.But why physical memory is increasing when only my process is running?

View 14 Replies View Related

Programming :: Process Does Not Write To Disk While On Background

May 18, 2011

I am doing a program that reads data from a gps and some other devices and writes some files with all the information. When I run it normally it works fine, but if I run the program in the background (with the ampersand) files are not created until I bring it to foreground or close it. I am confused, the program should run the same way with and without the ampersand. (Could it be that the main process that creates all the threads does not create them when it is executed in background? It seems like if the program is stopped until I take it to the foreground).

View 4 Replies View Related

Programming :: Scripting, Perl Or Bash; Run A Background Process, Get Pid?

Apr 1, 2010

pretty simple. how would you background a process from a script and get its process id at the same time?

View 6 Replies View Related

Programming :: Exit In Script Files Cause Konsole Terminal Itself To Exit?

Apr 11, 2010

I noticed that if I have "exit" in a bash script file., e.g. script.sh,that when the word "exit" is reached, and the script file being executed is not in the PATH nvironment, i.e. ". script.sh", the whole konsole shell profile is exited! What gives here? Is there another command compatible to "exit" to prevent this, or will I just have the leave the "." part in the PATH enviroment, which is, to my understanding, is not recommended? I desire for a "goto" function in bash script files

View 11 Replies View Related

Programming :: Why New Threads Exit When Main Thread Exit

May 22, 2010

In linux, creating thread is same as process (clone()), except the virtual address space gets shared with the parent.If a running main process(thread) creates new thread, and if main thread exits, why should the new thread too exit? both are different entities, The same doesn't happen if the child thread exits, the parent thread would be alive.

View 1 Replies View Related

General :: Fork Process Will Not Exit - Ksh

Aug 19, 2010

I've a script that forks to another script.

The problem is that the child will not return to main process.

Main script "fork.sh"

Code:

The child process "smb_fork.sh"

Code:

when running it from the terminal "sh -x ./foork.sh"

Code:

My goal is via cron connect to ~100 remote winXP computers and download a single file. There fore I like to fork the process.

View 1 Replies View Related

General :: Shell Command Equivalent To (Ctrl+C) To Exit From A Process?

Apr 1, 2011

I write a script to read a file which is something like a pipe (or) queue , which shows the running status.In normal case, if i open this file with cat command, i have to use ctrl+c to exit this . What command shall i use to do the same inside a shell script ? I have tried ^C in my script , but it does not exit the process.

View 6 Replies View Related

General :: Run Two Background Process?

Oct 26, 2010

i have ported linux into arm and i want to run two background process on target

i have two c programs a.c and b.c
i have cross compiled them as
arm-linux-gcc -o a a.c

[code]...

View 8 Replies View Related

Networking :: Process A Job In Background?

Feb 16, 2010

How can I run a job in background using putty? I'm try to run yum update but it will take some time. if I close putty the process will interrupt.

View 14 Replies View Related

General :: Run A Process In The Background?

Nov 16, 2010

Could you tell me how can I run a process in the background?

View 1 Replies View Related

General :: Pull Process / Job Into Background

Jan 17, 2011

I know of terminating a command with & and then moving it into the background by pressing Ctrl-Z and then bg [pid], and I also know of nohup. But say you started a process that turned out to take much longer than one expected, is there a way of pulling, so to speak, this process from another terminal screen into the background so that even if I log off from the server the process would continue?

View 2 Replies View Related

General :: Nohup Does Not Run Process In Background

Apr 11, 2011

I run

nohup bash -c "while [ true ]; do echo test; done"

from PuTTy SSH client but after this process is not runned in background instead nohup keeps to be foreground process in shell.

SW version: nohup (GNU coreutils) 8.5

View 1 Replies View Related

General :: Moving A Process To Background Using PID?

Mar 5, 2011

i want to send a running process to background .. normal commands like sleep i can able to move easily to bg .

# sleep 10
#Ctrl+z
#bg

[code]...

View 4 Replies View Related

General :: Way To See Only Process Running In Background?

Feb 23, 2011

Is there some way to see only the process running in the background?

View 4 Replies View Related

General :: Running Process In Background

Jan 14, 2011

Is there any way to run a long process in background so that it still remain in running state even if the user logout the system.

View 12 Replies View Related

Software :: Background Process Hangs?

Feb 10, 2011

I have a process A running in the background. When I start another process B also in the background, the system hangs the moment I hit any key. Process A and B communicate over a socket. Iam not even able to do a telnet to the system. Is there any precautions that I need to take while running in background

View 1 Replies View Related

CentOS 5 :: Sending Process To Background?

Apr 30, 2011

It's my first post and think not last here. I'm new to Linux system ( had a bit of unix programming at school but forgot already ). Please, take a good care of nooby me Now, let's get to the point

I have CentOS installed on one of my machnce, its my PHP development server. I also wanted to run a Minecraft server on it. I would like to skip autostart with init.d thing and be able to control it's run manually, but remotely. Thing is, when i log via putty to server and start server the server output is in terminal. When I close puty, ran application closes also. So I need to have putty window ran all the time.

So, since many programs can be run as background task (like httpd). Is there a way to log via putty. Start application and send it to process... log out of putty ( and application doesn't shut down with putty)?

Also, would be nice if I was possible to log to putty and switch to that application, so i could see server output, info and Issue commands. Basically, I want to start a service and be able to manage it via putty. and not close it when i terminate putty.

PS: I have installed Windows on CentOS server. Is there a way to issue a system start without loading whole GUI thing? When I was installing it I thought it would be easier to manage it with GUI, but now loading it only eats system resources and i unplugged monitor and mouse nad manage it only from Putty

View 9 Replies View Related

General :: Move Running Process To Background

Mar 10, 2011

How do you move a running process to the background? For example, type the command sleep 60 on the command line and try moving that process to the background.

View 1 Replies View Related

Ubuntu :: Run A Java Process In The Background Of A Terminal ?

Feb 16, 2011

I am running Ubuntu 10.10, and I am trying to run a java process in the background of a terminal, so I can continue to use that terminal.

Other applications will run in the background just fine, but when I run my java application, I cannot change the status of the process from "Stopped" after suspending it.

Here is my command syntax, along with some commands I have tried and their outputs:

There were [1]- entries, but I removed them for simplicity.

View 4 Replies View Related

General :: Process In Background Hogs 96% CPU But When Ran In Foreground Its Almost Zero

May 17, 2010

I am trying to solve one problem: When i run my process in background it hogs around 96% of CPU. But when ran in foreground, CPU utilization is almost zero. Is there any difference b/n a background and a foreground process wrto CPU utilization?

View 8 Replies View Related

Server :: Move Background Process To Foreground?

Mar 5, 2010

is it possible in bash to run one command in background and after it's done show output with less? While background process is running I should be able enter another commands.What I have is this (sleep is only for simulation):

Code:
{({ ( tree / > tree.txt && sleep 2) & } && wait && less tree.txt) &} && wait fg &
Problem is that I don't know and I can't find how to move it to the foreground after completion.

View 14 Replies View Related

Ubuntu :: Cron Leaves Defunct Process When Job Goes Background?

Apr 23, 2011

I'm using cron to run a tunnel. It is a looped script which never exits, and thats why I don't want cron to wait for it. This is a crontab entry:@reboot $HOME/cron/portfw.sh &When I run it manually, everything is ok. But when cron runs it, a defunct sh process keeps running until portfw.sh and it's child are killed. Somehow cron knows that processes spawned in background and keeps waiting for them and ignoring the fact that parent process exited. I tried using setsid to change spawned process group, but it did not full cron, it still knows about child processes

View 9 Replies View Related

General :: Dhclient Retry Working - Background Process

May 30, 2011

How the dhclient retry working(Background Process).

View 3 Replies View Related

General :: Sending Remote Command To Background Process + Out Log?

Feb 1, 2010

Because of my English skills I'll try to explain this subject as best I can, thank you for understanding. Fisrt of all, I am running some program on my slackware in background (using standard method - &). I need to make a script, which allows sending command to this process on my machine from another one. Furthermore this program have to be logged out (standard output f.e. ./myprogram > log.out.txt).It might be a separate Program A which runs my Program B but it cannot be screen, because it is not working like I'd like to and it cannot be java, because it's slow and working not the best so to speak

View 6 Replies View Related

Ubuntu :: Place A Process In The Background, Bring To Foreground?

May 18, 2011

q)how can i bring the backgroud process to foreground i tried like below1]hp-linux@hp-linux-desktop:/usr/share$ top

top - 11:28:24 up 1:57, 2 users, load average: 0.55, 0.65, 0.62
Tasks: 158 total, 3 running, 155 sleeping, 0 stopped, 0 zombie
Cpu(s): 6.1%us, 2.9%sy, 0.7%ni, 87.1%id, 3.0%wa, 0.2%hi, 0.1%si, 0.0%st

[code]...

View 4 Replies View Related

General :: Background Process Execution Hangs Console And Ip Communication?

Feb 9, 2011

I have 3 processes to be executed in a particular sequence.

ProcessA
ProcessB
ProcessC

The requirement is that all the processes should run as background processes.

ProcessA talks to ProcessB and ProcessC using sockets.
ProcessB talsk to ProcessA only using sockets.
ProcessC talsk to ProcessA only using sockets.

[Code].....

View 3 Replies View Related

General :: Running Program In Background In Child Emulator Process

Aug 26, 2009

I wonder how one can, if at all, run an X program in the background *in an emulator sub-shell process*. What I mean is to launch a program in an emulator, e.g, by xterm -e gedit

but with gedit (in this example) running in the background from inside the xterm sub-process, so that the xterm will accept other commands. In the above, gedit will run in the foreground, and of course, if you do
xterm -e gedit &

then xterm will run in the background, not gedit.In short, I would like to achieve the same thing as "gedit &" as you manually do in xterm, but from another shell. What I aim to do is write an X init script to achieve this result (to have the emulator open and a program or two running from it, in the background, at the X startup).

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved