Tag Info

New answers tagged

0

$ ip netns identify $PID where $PID is the process I.D. of the process, which you can get in various ways. http://man7.org/linux/man-pages/man8/ip-netns.8.html


0

It is not possible to create manually (in the usual way) a directory in /proc because it is not really a filesystem: it's a way for the kernel to show system and process information in a hierarchical, filesystem-like structure. The only way someone could create a directory under proc is by writing a kernel module that does so, but that would mess up things ...


3

No part of the official kernel currently does that, nor any third-party kernel module that I've seen. Only a kernel component could do that. I think that /proc/[0-9]* is common enough in shell scripts that no official kernel component will ever do that.


9

Check this Wikipedia link on Exec function and this link on Starting a process with the exec() calls e – An array of pointers to environment variables is explicitly passed to the new process image. The "e" suffix versions pass an environment to the program. An environment is just that—a kind of "context" for the program to operate in. For example, ...


1

According to http://www.di.uevora.pt/~lmr/syscalls.html, the suffixes indicate the type of arguments: l argn is specified as a list of arguments. v argv is specified as a vector (array of character pointers). e environment is specified as an array of character pointers. p user's PATH is searched for command, and command can be a shell ...


0

What you want is in this answer and this answer The only thing I'll add is the -u user option for ps eg: ps -u <username> to search processes started by a user.


0

When you start a process in the foreground, the shell will wait for it to complete (with one of the wait() family of system calls) before reading the next command. When you start a process in the background, the shell does not wait for it to complete or change state; it immediately reads and executes the next command. Note that whether or not you start a ...


3

program & will still have the same stdin and stdout as program, but program & usually (depending on your terminal settings) won't be able to read from stdin without getting stopped by the system via the SIGTTIN signal (see https://en.wikipedia.org/wiki/Job_control_(Unix)#Implementation ). Background processes won't receive signals from keyboard ...


1

It means a number of things. The backgrounded process is not holding up your terminal. It is being run "asynchronously" in that we are not waiting for it to complete. It will still die if disconnection is forced. Consequently the responses are not necessarily "active" but "passive", it is good form to redirect output to a file for later inspection. ...


3

To make a zombie process: $ (sleep 1 & exec /bin/sleep 10) This replace the shell which run sleep 1 with /bin/sleep 10 that won't know the sleep 1 process terminated, so creating a zombie in 10 seconds. I'm not sure what do you want when killing a zombie process. A zombie process was already dead, you can not kill it. Actually, you can make zombie ...


1

Not so interesting answer: $ (A=$BASHPID && ( kill -STOP $A )) [1]+ Stopped ( A=$BASHPID && ( kill -STOP $A ) ) $ ps -C bash PID TTY TIME CMD 29453 pts/0 00:00:00 bash 29593 pts/0 00:00:00 bash 29594 pts/0 00:00:00 bash <defunct>


0

There is no way to reliably and usefully check that an unrelated process is running: a race condition is always possible. Even if you find a way to detect whether the process you're interested in is running, it might be killed immediately after you've seen it, or conversely it might get started immediately after you missed it. If you control the program or ...


3

The ps ax | grep -v grep | grep "XML2DB.jar -n" technique has a race condition: the grep instances may or may not get started in time for ps to see them, so you get inaccurate counts: see here and here. You aren't the first one to get in trouble using it. I did an strace pgrep somepattern on a RHEL box to find out what pgrep is doing. It stats every process ...


0

Depending on operating system -- via routing socket (BSD family) or netlink socket (Linux). Very brief overview of available kernel interfaces is in GNU Quagga's documentation.


1

The setrlimit(2) syscall is relevant to limit resources (CPU time -integral number of seconds, so at least 1 sec- with RLIMIT_CPU, file size with RLIMIT_FSIZE, address space with RLIMIT_AS, etc...). You could also set up disk quotas. The wait4(2) syscall tells you -and gives feedback- about some resource usage. And proc(5) tells you a lot more, and also ...


3

In general, it isn't possible for a shell to “adopt” a job. For a shell, a job means a few things: Associate a job identifier with a process ID. Display its status (running, suspended, dead). Notify the user when the status changes. Send a SIGHUP signal when the terminal goes away. Control whether the job “owns” the terminal (whether it's the foreground ...


1

Both have there own + and - : nohup: nohup is good to use for running procs in background when proc don't need any user input like httpd server or any other server proc like that. nohup does create log in dir of proc execution. log file name default is nohup.out It avoids proc getting killed due to mistaken ctrl+C , ctrl+D . Just a safe guard. It's ...


3

The process name is nautilus. Nautilus contains its own code to copy files, this code is executed inside the nautilus process, not in a subprocess. You can see for yourself what subprocesses Nautilus runs by logging its system calls with strace: strace -f -o /tmp/nautilus.strace nautilus The clone system call creates new processes (it's a generalization ...


2

How about ps -eL -o user,pid,psr,comm,args. psr field gives you the processor currently assigned to that thread.


4

Processes in state D (uninterruptable sleep) cannot be killed while they are in this state. NFS was notorious for this but there are other ways to get a process stuck. Broken device drivers that don't return control to the calling process can also cause this behavior. One would need to reset the driver, but in general there is no way to do this. I hate to ...


6

Because of how waitpid works. On a POSIX system, a signal (SIGCHLD) is delivered to a parent process when one of its child processes dies. At a high level, all waitpid is doing is blocking until a SIGCHLD signal is delivered for the process (or one of the processes) specified. You can't wait on arbitrary processes, because the SIGCHLD signal would never ...


0

Get a friend to try logging in, or use a smartphone, or go to a public hotspot and try from there, or leach the internet of your neighbours, or just wait until some scriptkiddo tries to log in. There are many ways, but they all involve "just do it"...


3

nohup should only affect the hangup signal. So kill should still work normally. Maybe you are using the wrong pid or process name; compare with pstree -p or ps -ef. If you still suspect nohup, maybe you could try disown instead. $ sleep 1000 & $ jobs -p 13561 $ disown $ jobs -p $ pidof sleep 13561 $ kill 13561 $ pidof sleep $


1

If you used nohup, you can't kill them. The nohup command specifically prevents those processes from receiving the kill signals. If you simply used &, you can kill them by sending a kill or kill -9 to the PID. Well, you can kill them by rebooting the machine, but that might be a bit more extreme than you really want...


0

I assume, that you don't have only 9 processes. You could use, eg: pgrep sched pgrep bdflush or ps -u root | grep sched ps -u root | grep bdflush If there is no output, than the processes are not running.


2

The child could send a signal to the parent. SIGUSR1 and SIGUSR2 exist for this kind of ad hoc situation and could be ideal here. Your application can find its parent's process id easily enough with the Java equivalent of getppid(), or as an alternative perhaps you could have the parent pass its own PID ($$) on the command line as an argument that your Java ...


5

You can stop the process with ctrl-z. Then do whatever you want in the terminal. To continue the process use fg. Or from another terminal, use: kill -19 <pid> It sends SIGSTOP (signal number 19) to the process. This is not possible to catch for the process. To continue the process use: kill -18 <pid> This time it's SIGCONT that brings the ...


27

A minus sign before the command name is a convention that login programs use to start login shells. A login program is a program where you typically type your password and that starts a session for you, such as login, sudo -i, su -, sshd, etc. A login shell is the initial shell of a text mode session. Conventionally, when a program invokes another program, ...



Top 50 recent answers are included