kill: Send a signal to one or more processes.

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

kill sends a signal to a process. killall sends a signal to all processes forked during the current session.

Usage

1
2
kill(pid, signal = 15)
killall(signal = 15)

Arguments

pid

Process ID for the target process

signal

Signal number to send. Defaults to 9 (SIGKILL)

Details

The kill function provides a thin wrapper around the Unix "kill" system call, which sends a signal to the specified process. The killall function sends a signal to all processes which have been forked during the current session.

Refer to the local Unix man pages for details.

Value

kill returns 0 on successful completion, -1 on errors. killall does not return a value.

Author(s)

Gregory R. Warnes greg@warnes.net

References

"kill" and "waitpid" man pages

See Also

getpid, exit, wait, kill, killall

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
   # start a process that just sleeps for 10 seconds
    sleepy <- function() 
     {
       cat("Going to sleep..")
       Sys.sleep(10)
       cat("Woke up!")
     }
   pid <- fork( sleepy )

   # kill the sleeping process
   kill(pid)

warnes/fork documentation built on May 4, 2019, 12:59 a.m.