Would
not work? -l == act as if it were a login, meaning it creates a new process tree?
I believe it calls setsid() and creates a new separate process group.
My bash is v 2.05 which does not support the -l option. Correct me if I'm wrong on this, please.
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)
my shell is /sbin/sh. i added stty susp '^Z' with the intention of being able to switch between foreground and background. but the result was strange.
i had 2 servers. one is sun the os is 8 and the other is hpux v11. both of them had the same shell. but on hpux, it works perfectly fine while... (9 Replies)
I wrote a ksh script for Helpdesk. I need to know how to disable ctrl-c,ctrl-z,ctrl-d..... so that helpdesk would not be able to get to system prompt :confused: (6 Replies)
how to trap the ctrl c in unix shell script
my script is running in while loop it should not be terminate with ctrl c.
if i press ctrl c while running script it shloud ignore the same.
please healp..........
thanks in advance (2 Replies)
I am trying to trap CTRL-C, now the program I call has it's own exit message, I think this is the problem ..
This is what I have now :
function dothis
{
echo 'you hit control-c'
exit
}
function settrap
{
trap dothis SIGINT
}
settrap
until false; do
./ITGRecv.exe
doneDoing this I... (2 Replies)
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)
Hi All,
Although each line below seems to work by itself, I've been having trouble getting the Control-C trap working when I add the "|perl -pe..." to the end of the tail -f line, below.
(That |perl -pe statement basically just adds color to highlight the word "ERROR" while tailing a log... (2 Replies)
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)
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)
Hello:
Am trying to understand why the method #2 works but method #1 does not.
For both methods, sending CTRL+C should kill both the Parent script & all of the spanwd background procs.
Method #1:
==========================
#!/bin/sh
ctrl_c()
{
echo "** Trapped CTRL-C"
... (3 Replies)
Discussion started by: gilgamesh
3 Replies
LEARN ABOUT NETBSD
setsid
SETSID(2) BSD System Calls Manual SETSID(2)NAME
setsid -- create session and set process group ID
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
pid_t
setsid(void);
DESCRIPTION
The setsid() function creates a new session. The calling process is the session leader of the new session, is the process group leader of a
new process group and has no controlling terminal. The calling process is the only process in either the session or the process group.
Upon successful completion, the setsid() function returns the value of the process group ID of the new process group, which is the same as
the process ID of the calling process.
ERRORS
If an error occurs, setsid() returns -1 and the global variable errno is set to indicate the error, as follows:
[EPERM] The calling process is already a process group leader, or the process group ID of a process other than the calling process
matches the process ID of the calling process.
SEE ALSO getsid(2), setpgid(2), tcgetpgrp(3), tcsetpgrp(3)STANDARDS
The setsid() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1'').
BSD April 4, 2011 BSD