Sponsored Content
Top Forums Programming using popen with background process Post 302085971 by jim mcnamara on Monday 21st of August 2006 12:31:52 PM
Old 08-21-2006
I can't try this, but you need stdin, stdout, stderr for that command line to work.
The only thing I can think of is to force creation of a new process with default streams to login on the same box. rexec, ssh, maybe telnet.

I don't know how to set up localhost authentication for ssh or remsh, but assuming it can be done try:
Code:
sprintf(ps,
"remsh localhost - l  %s /usr/bin/ps -fu %s | /usr/bin/grep '%s' | /usr/bin/grep -cv 'grep' > two.tmp", getlogin(), getlogin(), bin);

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

capture the process id when starting a background process

Hello all, How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename. Any assistance is most appreciated. Thanks, Jim... (10 Replies)
Discussion started by: jleavitt
10 Replies

2. Shell Programming and Scripting

background process

Hi, In shell script when I use script1 >> filelog the echo statments of script1 gets printed in the filelog but when I try to run script in background i.e, script1 & >> filelog nothing gets printed in the filelog. Anybody knows whats going on here. thanks (3 Replies)
Discussion started by: k_oops9
3 Replies

3. UNIX for Dummies Questions & Answers

background process

How, can I hide background process's output? (5 Replies)
Discussion started by: zylwyz
5 Replies

4. Shell Programming and Scripting

background process

Hello, This has probably been answered in other forms, however I would like to confirm this statement before I use it in production. Will this syntax work for a background process? echo "nohup server_process1 >/dir1/nohup.server_process1 2>&1 &" | ksh Please advise. Thanks (1 Reply)
Discussion started by: jerardfjay
1 Replies

5. Shell Programming and Scripting

background process

i gave a copy process in the background( to copy around 100GB) , while in progress, the session got terminated. when i relogged in and checked the destination folder the copying was in progress... how could it happen(copying) when the shell terminates??? :rolleyes: (2 Replies)
Discussion started by: vinod.thayil
2 Replies

6. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

7. AIX

Background process

how to check the process running in background? how can i run a process in background? pls explain with commands (1 Reply)
Discussion started by: udtyuvaraj
1 Replies

8. Shell Programming and Scripting

How to put FTP process as a background process/job in perl?

Hi, I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming. So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies

9. Shell Programming and Scripting

Make background process interact with fg process

Hi, I have written a menu driven shell script in which as per the choice, I run the another script on background. For eg: 1. get info 2)process info 3)modify info All the operations have different scripts which i schedule in background using &. However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies

10. Shell Programming and Scripting

Subprocess.popen() should write to log without waiting for process to complete

Here is my test code process = sp.Popen( + , bufsize=1, universal_newlines=True, stdout=sp.PIPE, stderr=sp.STDOUT, cwd=src_home) output, _ =... (2 Replies)
Discussion started by: ezee
2 Replies
iv_popen(3)						    ivykis programmer's manual						       iv_popen(3)

NAME
IV_POPEN_REQUEST_INIT, iv_popen_request_submit, iv_popen_request_close - popen(3) for ivykis applications SYNOPSIS
#include <iv_popen.h> struct iv_popen_request { char *file; char **argv; char *type; }; void IV_POPEN_REQUEST_INIT(struct iv_popen_request *this); int iv_popen_request_submit(struct iv_popen_request *this); void iv_popen_request_close(struct iv_popen_request *this); DESCRIPTION
iv_popen provides ivykis(3) applications with an asynchronous version of popen(3) that is integrated with the ivykis event loop. After initialising a struct iv_popen_request object using IV_POPEN_REQUEST_INIT and assigning its ->file and ->argv and ->type members, one can call iv_popen_request_submit on it to fork off a child process which will call execvp(2) on ->file and ->argv, while in the parent process returning a file descriptor that is connected to the child's standard input (if ->type equals "w") or standard output (if ->type equals "r"). When the application is done with the child process, it should call iv_popen_request_close, and close the file descriptor returned by iv_popen_request_submit (this is not done automatically). iv_popen will continue to monitor the child's process state while it is running, by registering an iv_wait(3) interest for its process ID. If the child process has not yet terminated when iv_popen_request_close is called, iv_popen will attempt to terminate the child process in the background by sending it a series of SIGTERM and SIGKILL signals. iv_popen_request_close must be called from the same thread that iv_popen_request_submit was called from on this object. SEE ALSO
ivykis(3), iv_wait(3), execvp(2), popen(3) ivykis 2010-09-04 iv_popen(3)
All times are GMT -4. The time now is 08:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy