Programming :: Notify When A Process Closes?

Jan 28, 2011

It is possible to know when any process is closed? When I refer to any process, is a process that is not a child of my application.

I thought perhaps pipes in /proc/[pid]/fd/..

View 6 Replies


ADVERTISEMENT

Debian Programming :: Command Followed By And Still Closes With Terminal?

Jan 4, 2014

Running debian wheezy. I noticed recently, whenever I fork a process using "&" from a terminal, such as

Code: Select allleafpad &

it starts up, shows the processid in the terminal, but every time when I close the terminal, leafpad gets killed. However, I create a simple bash script,

Code: Select all#!/bin/bash
leafpad&
exit

The script launches leafpad, then exits out leaving leafpad running, as it should. Is what I mentioned above normal? I'm confused, because I think I used to be able to do this in terminal without it depending on the terminal to stay running.

I guess I'm remembering wrong. As it turns out, commands begun on terminal get closed with terminal unless, as mentioned, you use nohup or start subshell. Process hierarchy and tracking etc.

View 6 Replies View Related

Programming :: Displaying Process Id In Shell Script But There Is No Such Process?

Nov 9, 2010

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

result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')
echo $result
if [ "$result" == "" ];

[code]...

View 4 Replies View Related

Programming :: Difference Between Init.rc Process And Normal Process?

Mar 31, 2011

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...?

View 1 Replies View Related

Programming ::get The PID Of The Process Giving Kill Signal To A Process?

Nov 26, 2008

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

View 2 Replies View Related

Programming :: Showing Process Id But There Is No Such Process?

Nov 9, 2010

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
result=$(ps -ef | grep -v grep | grep "applicationname.sh" | awk '{print $2}')

[code]...

View 14 Replies View Related

General :: Killing Parent Process Without Killing Child Process (Linux C Programming)?

Mar 10, 2011

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?

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

[code]....

View 1 Replies View Related

Programming :: Under Which Circumstances A Child Process Creates Another Child Process Using Fork

Dec 7, 2009

Consider the following code:

Code:

int main()
{
int i=0;
pid_t pid;
for(i=0;i<2;i++)

[code]....

I get the following output:

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?

View 3 Replies View Related

Programming :: Unix Programming - Single Process That Does Not Start Up Any Other Threads

Sep 28, 2010

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.

View 3 Replies View Related

Programming :: How To Get Process ID Using Pidof

Jan 31, 2011

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

[Code].....

View 5 Replies View Related

Programming :: Force Two Process To Run On The Same CPU?

Jan 11, 2011

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.

View 1 Replies View Related

Programming :: Know Status Of Process With PID?

May 25, 2010

How can I programatically know the status of a process if its PID is known?

View 1 Replies View Related

Programming :: Using Copy_from_user With 2 Process?

Oct 20, 2010

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.

View 1 Replies View Related

Programming :: Batch Process Files In VI?

May 29, 2010

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.

View 3 Replies View Related

Programming :: Getting The CPU & (Virtual) Memory Of A Process?

Aug 23, 2010

Is there any program which gets the CPU and memory of a process ?

View 1 Replies View Related

Programming :: Maximum Ports Per Process?

Dec 8, 2010

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

View 5 Replies View Related

Programming :: Listing All Threads In A Process?

Dec 29, 2010

How to list all the threads spawned by a process?

View 4 Replies View Related

Programming :: Process Memory Allocation

Apr 30, 2011

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?

View 4 Replies View Related

Programming :: Set Supplementary Groups Of Process?

Mar 20, 2010

Unfortunately the setuid() function from unistd.h does not effect the supplementary group ids of the process. Is there a way to set them directly? Even better, is there a setuid() equivalent which also sets the process's supplementary gid's to match the user's?

View 2 Replies View Related

Programming :: PID Of A Process Changes During Its Life Cycle?

Jan 27, 2010

Is the PID of a process changes during it�s life cycle in linux ?Or it�s PID is fixed throughout of process�s life cycle.

View 2 Replies View Related

Programming :: Automating Process Of Asking Question

Mar 10, 2011

I need to ask a question on many forums/mailing lists.In such a situation I need to open browser and login to many forums at the same time.Then go and format it according to forum guidelines and then paste it.So I want to know if I can automate this process some way by some alias or command line utility and just type the question in a text file and give URLs on command line and the question gets posted to those forums where I request?

View 7 Replies View Related

Programming :: Communication Data Between Different Process

Nov 22, 2010

I would like to send struct data from process A to process B but I dont known what is the best way. I have read about IPC, but there are a lot of ways to do it.

View 2 Replies View Related

Programming :: CPU Sharing Between Process And Threads?

Mar 29, 2011

I have doubt regarding cpu sharing between process and threads.In my program iam creating 4threads=> 1 process+4 threads. How is cpu alloted to these all tasks. Is here process is getting cpu time like thread or having more cpu time than threads.

View 1 Replies View Related

Programming :: Get The Creation Time Of A Process Via Pid In C++

Mar 22, 2010

Scenario: ( in C++ code)

I need a process A to be able to get the start time of process B. I have the PID of the process B.

I would have thought there would be a simple system call to make by passing in the pid of Process B, but I don't thing there is??!!

So my other thought is to create a script that will be passed the pid and either I can read the file creation of /proc/<PID>/stat or I could also parse the start time of ps on the <PID>. This script can be ran from the C++ code. My difficulty is capturing this information in the C++ code. If I run exec ( or system if not a script) I need the results in a program variable....not stdout.

My only solution is write it to a tmp file and read it back into the program variable. Seems rather arguious but a least it would work.

Background - I need to port Windows code ( GetProcessTimes(creationtime,...))

View 4 Replies View Related

Programming :: Getting The Name Of The Process That Sent Data To A Pipe?

Feb 16, 2011

I am trying to automate some directory naming when we're manually running some scripts and are using tee to direct the output to a file (log). Right now this is what we do

Code:

./some_script.sh 2>&1 | tee /home/user/some_dir/logs/manual/some_script_20110216_1628.log

As a matter of laziness and keeping the log files consistently named, I'd like to create a function to pipe it to so that it's doing all the naming How I envision the command running

Code:

./some_script.sh 2>&1 | myfunc

And what the logfile name should look like (and in the right directory)

Code:

some_script_20110216-1628.log

I was thinking of adding a function to our profile to handle this. Just in testing I was trying to stream line right on the command line, but I'm having some difficulty in getting the name of the script that is pushing data over the pipe. Here is what I've tried

Code:

./some_script.sh 2>&1 | tee $(cd ../logs/manual; pwd)/$0_$(date +%Y%m%d)-$(date +%H%M).log

but that created a file named

"bash_20110216-1628.log"

View 3 Replies View Related

Programming :: Pthread_create Does Not Return The PID ( Process ID)?

Aug 5, 2010

I am using pthread_create system call to create a thread. However pthread_create does not return the PID ( process ID). Is there any quick way to fınd the PID of the created thread.

View 1 Replies View Related

Programming :: How To Kill Process Of Script

Aug 13, 2010

My script in /usr/bin displays the time on the console tty1 :

Quote:

if [ $(echo &>/dev/null > /dev/tty8; echo $?) -eq 0 ]
then
while [ 1 -lt 2 ]
do

[code].....

I'm started this script : /usr/bin/showtime How i can kill process of this script.

View 2 Replies View Related

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.

View 3 Replies View Related

Programming :: Kill More Than One Process In System?

Apr 27, 2010

I wanted to know how to kill more than one process in unix??
e.g- I have problem statement as
"Write a shell script to Kill all processes started from your login "

View 11 Replies View Related

Programming :: Process An Email Form Using PHP?

Jan 21, 2009

I am trying to process an email form using PHP.It is working okay so far but I want the Items to be displayed as a list when the email is received. eg.

one
two
three
four

and not

one two three four

here is a copy of the variable that displays the message

View 14 Replies View Related







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