Programming :: How To Relaunch Process After It Terminates
Mar 1, 2010
I am trying to relaunch a process after it's name, not pid, terminates in C++. Is this possible? I am using g++ 4.3-4.4 on Fedora 10, wandering between my x86 and ppc machines. I just recompile.
I have p1,p2,p3,p4 some processes created by me in C. p1, p2, p3 are started individually from several consoles. And I want process p4 to terminates processes p1, p2, p3 if they are running. Which is the easiest way to accomplish that? put all processes in the same process group and send from p4 a kill signal to the group. But I couldn't do that because I cannot call successfully setpgid(getpid(), 15000) from p1-p4. It's there some way to put them in the same group? the processes don't have a child-parent relationship, they are launched manually from consoles.
I want to spawn a GDB session from bash script and keep it working to interact it from outside. But when I start it in background (with '&' sigil).
Code: gdb -x gdb_script.txt ./a.out < gdb_pipe.fifo & It executes passed script and terminates by itself (I do not pass any data or signals to it)
Code: Breakpoint 33, main (argc=1, argv=0xbffff0f4) at main.c:53 ---Type <return> to continue, or q <return> to quit---53 read_main_config(); (gdb) quit
A debugging session is active. Inferior 1 [process 5957] will be killed. Quit anyway? (y or n) [answered Y; input not from terminal] What can I do to make it alive?
I was installing amahi last night using this method "http://wiki.amahi.org/index.php/Self-install-existing" since i can't do the usual install. I followed all 6 steps and was at the stage where the amahi web based installer was running. It got to 78%Setting up HTTP connection and got stuck there, i left it going all night and eventually decided to reboot and try again.Now i can't get the installer URL... to launch! it just says "unable to connect"in firefox.I just did all the six steps again but still nothing so im not sure what to do. I was going to try Add/Remove programs but for some reason my version of fedora doesn't seem to have it!!
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh Code: #!/bin/bash
Is there any difference in cpu usage for process in init.rc(runs automatic when boot is happened) and manually running process. Will these both have same priority by default...?
I tried googling but didn't get any answer for this.I have a process called "abc" and it is running with PID "123".I have a putty session opened with PID "999".I am giving kill -TERM 123 from putty session.My process "abc" before dying it should catch the PID of the terminal which provided TERM signal to it.Is there any way to find this out
I have a shell script to identify whether the process is running or not. If the process is not running, then I execute another script file to run my application. Below is my script and saved this script as monitorprocess.sh
I want to kill parent process after "fork()" method. but if I kill parent process with "exit(0)" method, main() thread is terminated as well so child prosess doesn't work anymore. Is there any way to kill only parent process without affecting to child process?
Parent: chid_pid=4356 i=0 parent's pid=4355 This is child 4356 i=0 This is child 4357 i=1
[code]....
I can observe instead of two children(as I expect) processes there are three. This is because child process 4356 creates its own child. Why all the messages of the type "This is child X i=Y" are concentrated one under another? How exactly fork works? Is affected by the fact that I have a dual-core processor?
i want a process that can operate as both a TCP echo server and a UDP echo server. The process can provide service to many clients at the same time, but involves a single process that does not start up any other threads.
I tried to install 11.3 today but no luck so far. I installed it 3 times from GNOME liveCD and once from a LiveUSB both didn't work. With the CD, it restarts before installing initrd, GRUB tells me : error 15 : file not found. I verified both the image I downloaded via md5 and the CD I made and they both are OK.
I am using kppp in ubuntu10.10 to connect via my samsung c3010 mobile and Airtel connection. But when I dial through it, it terminates on signal 15! Some requests are rejected it seems. I am pasting the log:
Dec 14 20:08:02 pratik pppd[1883]: pppd 2.4.5 started by pratik, uid 1000 Dec 14 20:08:02 pratik pppd[1883]: using channel 5 Dec 14 20:08:02 pratik pppd[1883]: Using interface ppp0 Dec 14 20:08:02 pratik pppd[1883]: Connect: ppp0 <--> /dev/ttyACM0
[Code]....
I am connecting the modem over USB. The GUI shows me it is dialling the number, and then connecting to the network, and after a while ( it sends it 9 times it seems) it terminates.
I tried to find an answer to whatever is happening with my sh, tried a few approaches, but none is working the way I planned... the loop quits with exit 0, runs once, if I comment out 'ffmpeg' line, it runs N times as it should - ffmpeg does not error out other than 0.
This sh runs once, echoes "inside" 'n "outside" once, exits with '0'... unless ffmpeg commented out. I also tried to feed the loop with: done < /tmp/fname.list. BTW, this works well - but I am very interested in the >while read< loop giving up.
Code: for i in *.mp3; do ffmpeg -i "$i" -acodec libvorbis -ac 2 -aq 4 -y "$(basename "$i" .mp3).ogg"; done
I use ubuntu 9.10 karmic koala as my desktop OS. My internet connection is creating problems these days, ever since I started downloading torrents for iso files. Whenever the downloads in transmission client is running, the internet gets disconnected abruptly, and even my other downloads in d4x stops. On using the plog command in the terminal, it shows the following:
I dont understand much of it, as am a new user using linux systems from only a few months ago, can't find out. Also on closing the transmission client the other downloads in d4x run perfectly well and so does my internet connection.
We are running Ubuntu on VMWare EXS Server 3i (32 bit server). We tried upgrading from Version 9.4 to 9.10. The server will not boot. It throws networking errors then just comes to a blank black screen.
Here is most of the screen: /dev/sda5 was not cleanly unmounted, check forced. (note - this is due to having turned it off at the black screen - that much I get) /dev/sdd1: recovering journal /dev/sdb1: recovering journal /dev/sdc1: recovering journal /dev/sdb1: clean, 74772/6553600 files, 15793957/26214055 blocks (check in 5 mounts) /dev/sdd1: clean, 22599/6553600 files, 15036060/26214055 blocks /dev/sdc1: clean, 381500/13107200 files, 34291998/52428119 blocks Filesystem checks are in progress (ESC to cancel): ***** here is where I think things are going bad ************ init: network-interface (eth0) pre-start process (535) terminated with status 1 init: network-interface (eth0) post-stop process(61 terminated with status 1 init: network-interface (lo) pre-start process (615) terminated with status 1 init: network-interface (lo) post-stop process(62 terminated with status 1 /dev/sda5: 105/124496 files (34.3% non-contiguous), 18894/.248976 blocks mountall: fsck /boot [410] terminated with status 1 fsck from util-linux-ng 2.16 /dev/FileU32-root: clean, 69429/734400 files, 540860/2933760 blocks init: networking main process (70 terminated with status 1
Just like the title says, if I were to try to run anything through gksu and accidentally put in an incorrect password, instead of the gksu window coming up again, it would just terminate.
I did an upgrade from pardus 2009 to 2009.1. When all the packages finished downloading and started installing, the power went off suddenly. Now my system is boots fine till the graphical login, but after I enter username and password, desktop fails to load and I am back at the login screen. I tried to resume the upgrade using (# pisi upgrade) but pisi terminates after checking the repositories. What to do?
If i have, say, ..... tab opened and if a click on some of the related videos (while it's still playing) firefox terminates. The same if I open ..... on one tab and myspace on another - firefox just shuts down.
I want to know why this happens, is it a bug and how can i fix it ?
..... tab opened and if a click on some of the related videos (while it's still playing) firefox terminates. The same if I open ..... on one tab and myspace on another - firefox just shuts down.I want to know why this happens, is it a bug and how can i fix it ?
I tried to get process ID using pidof. It didn't give any error but a blank output at console Code: $ pidof -s instance1
$ But when I use ps -ef, I get the process ID Code: $ ps -ef | grep instance1 root 4174 21661 0 06:52 pts/1 00:00:00 grep instance1 provgw 30220 30219 28 06:46 pts/1 00:01:44 /usr/java/jdk1.6.0_18/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
I'm programming a software system that consists of multiple processes. It is programmed in C++ under Linux. and they communicate among them using Linux shared memory.
Usually, in software development, is in the final stage when the performance optimization is made. Here I came to a big problem. The software has high performance requirements, but in machines with 4 or 8 CPU cores (usually with more than one CPU), it was only able to use 3 cores, thus wasting 25% of the CPU power in the first ones, and more than 60% in the second ones. After many, many research, and having discarded mutex and lock contention, I found out that the time was being wasted on shmdt/shmat calls (detach and attach to shared memory segments). After some more research, I found out that these CPUs, which usually are AMD Opteron and Intel Xeon, use a memory system called NUMA, which basically means that each processor has its fast, "local memory", and accessing memory from other CPUs is expensive.
After doing some tests, the problem seems to be that the software is designed so that, basically, any process can pass shared memory segments to any other process, and to any thread in them. This seems to kill performance, as process are constantly accessing memory from other processes.
Now, the question is, is there any way to force groups of process to execute in the same CPU?. I don't mean to force them to execute always in the same processor, as I don't care in which one they are executed, but that would do the job. Ideally, there would be a way to tell the kernel: If you schedule this process in one processor, you must also schedule this "brother" process (which is the process with which it communicates through shared memory) in that same processor, so that performance is not penalized.
Is there a way to send/receive messages between 2 process using copy_from_user and copy_to_user ? I'm looking for some article, but did not found anything.
I'm completely new to scripting and I'm trying to figure out how to write a script that will get a list of all the files in a directorywn through any subdirectories.When I have the list I want to o each file in VI and change the fileformat. So far all I have been able to figure out is that VI can do the batch processing and that "ls -R" gets me the recursive file list. I'm still pretty clueless on how to do the batch process with the VI editor. I think I'm supposed to use the Ex mode but I don't know how to get the list of arguments from the filelist into the editor so they can be processed. If it matters the files were all written in a Windows editor and have gotten the MS carriage returns so I want to do a :set ff=unix command on all the files without having to go into each file manually, there are over 300 files that need updated.
I'm trying to build a multi-threaded server "C" program connecting to multiple clients. For various design reasons, I thought of having one port number per client. What is the maximum number of ports my process can handle
I have been assigned a school project on detecting memory leaks in linux processes. I am reading.. but have found it hard and inefficient to go through the very vast documentation not knowing what to really look for. Could you please give me some guidelines on this subject?