Checks for processes running on a local or remote machine.

Share:

Description

One of the use cases for this function is to ensure that an R process is already running and not start another one accidentally.

Usage

1
2
ps.grep.remote(grep.string, remote, stop.if.any = FALSE,
  stop.if.none = FALSE, count.self = FALSE, ps.options = "aux")

Arguments

grep.string

String(s) to check for in ps. If a vector, runs a chain of piped grep commands for each string.

remote

Remote machine specification for ssh, in format such as user@server that does not require interactive password entry. For local execution, pass an empty string "" (default).

stop.if.any

Stop if any of grep.string is running

stop.if.none

Stop if none of grep.string is running

count.self

When FALSE, excludes the calling process name from the count, if it gets matched.

ps.options

Gives the ability to run different options to ps.

Note

This may not work on Windows.

See Also

run.remote

Examples

1
2
3
4
5
6
## Not run: 
# Check if Eclipse is running.
ps.grep.remote("Eclipse", remote = "")
# [1] TRUE

## End(Not run)