Sponsored Content
Top Forums Shell Programming and Scripting Need to know rhe PID for the Shell Script running Post 302104438 by pbsrinivas on Thursday 25th of January 2007 07:02:19 AM
Old 01-25-2007
That was great piece of code but..

The Code u gave starts a back ground process and immeditly kills it



My requirement goes this way

when i run a script say "ABC"

1-- it should stop the .Statistics script by killing the previously running .Statistics

2-- then restart the .Statistics script again
 

10 More Discussions You Might Find Interesting

1. Linux

Display to PC via ssh/putty (RHE 5)

Hi all, I just installed Red Hat Enterprise and I would like to have the KDE/GNOME windows display to my PC. When I am root (via ssh, putty) I type startx but it fails. I'm not sure what has to be configured! Any help would be greatly appreciated. Thanks! (1 Reply)
Discussion started by: kjbaumann
1 Replies

2. Solaris

Running from Shell Vs running from RC script

Hi, i have a script which need to do behave differently when run as a startup process from init.d/ rc2.d script and when run manually from shell. How do i distinguish whether my script is run by init process or by shell?? Will the command /proc/$$/psinfo | grep "myscript" work well???... (2 Replies)
Discussion started by: vickylife
2 Replies

3. UNIX for Dummies Questions & Answers

How to find the details of the previously running process with PID

OS: Unix or Linux I (only) know the pid of the process which was running earlier (say 5 hrs back) but it is not running now. Is there a way I could find the details of that process? (atleast the name of the process). Please let me know. (2 Replies)
Discussion started by: vijay.d
2 Replies

4. UNIX for Advanced & Expert Users

delete all PID that running by UID ??

Hi experts, How can I delete the process running by particular UID. For an example- I want to delete all PID that running by UID- purple UID PID PPID C STIME TTY TIME CMD purple 120 122 0 Jan 17 ? 0:02 sched purple 234 235 0 Jan 17 ?... (6 Replies)
Discussion started by: thepurple
6 Replies

5. Shell Programming and Scripting

shell script for getting pid of spawn processes from shell

Hi, I am new this forum. I request you peoples help in understanding and finding some solution to my problem. Here it goes: I need to perform this set of actions by writing a shell script. I need to read a config file for the bunch of processes to execute. I need to fecth the pid of... (4 Replies)
Discussion started by: sachin4sachi
4 Replies

6. AIX

Having problem with executing shell script to get the pid details!

Hello Everyone, I am new to shell scripting and also i am very new to AIX machine I have a question. I have shell script which contains the follwing "ps -e |grep $1 echo $2" i run this schell script by doing this ./startSehllscript 3444 passed with two parameters . Accroiding my... (4 Replies)
Discussion started by: swati
4 Replies

7. Shell Programming and Scripting

Check process running Status with PID

Good day I am fairly new to Shell Scripting. I want a script to check if a process is up by checking the process's PID and then return a value for when it's running which would be 0. If it isn't running it should give any other value that 0. Any Help is appreciated Regards (9 Replies)
Discussion started by: 1nsyz1on
9 Replies

8. Shell Programming and Scripting

kill PID running in background in for loop

Guys, can you help me in killing the process which is running in back ground under for loop I am not able to find the PID using ps -afx|grep <word in command I entered> (1 Reply)
Discussion started by: mohan_xunil
1 Replies

9. Shell Programming and Scripting

Cp not working in shell script but running perfectly from shell

Dear All, I have script. Dest="" IFS=' ' for translation in $(echo $MY_MAP) do t1=$(echo $translation | cut -d"=" -f1) t2=$(echo $translation | cut -d"=" -f2| cut -d"," -f1) if then Dest=$UNX/$u_product_path/$u_study_path/$UNXTR/$t2 break; ... (4 Replies)
Discussion started by: yadavricky
4 Replies

10. Shell Programming and Scripting

Shell script to report file size, pid and also kill the process

Hi All, Looking for a quick LINUX shell script which can continuously monitors the flle size, report the process which is creating a file greater than certain limit and also kill that process. Can someone please help me on this? (4 Replies)
Discussion started by: vasavimacherla
4 Replies
Statistics::R(3pm)					User Contributed Perl Documentation					Statistics::R(3pm)

NAME
Statistics::R - Perl interface with the R statistical program DESCRIPTION
Statistics::R is a module to controls the R interpreter (R project for statistical computing: http://www.r-project.org/ <http://www.r- project.org/>). It lets you start R, pass commands to it and retrieve the output. A shared mode allow to have several instances of Statistics::R talk to the same R process. The current Statistics::R implementation uses pipes (for stdin, stdout and and stderr) to communicate with R. This implementation should be more efficient and reliable than that in previous version, which relied on reading and writing files. As before, this module works on GNU/Linux, MS Windows and probably many more systems. SYNOPSIS
use Statistics::R; # Create a communication bridge with R and start R my $R = Statistics::R->new(); # Run simple R commands my $output_file = "file.ps"; $R->run(qq`postscript("$output_file" , horizontal=FALSE , width=500 , height=500 , pointsize=1)`); $R->run(q`plot(c(1, 5, 10), type = "l")`); $R->run(q`dev.off()`); # Pass and retrieve data (scalars or arrays) my $input_value = 1; $R->set('x', $input_value); $R->run(q`y <- x^2`); my $output_value = $R->get('y'); print "y = $output_value "; $R->stop(); METHODS
new() Build a Statistics::R bridge object between Perl and R. Available options are: r_bin Specify the full path to R if it is not automatically found. See INSTALLATION. shared Start a shared bridge. When using a shared bridge, several instances of Statistics::R can communicate with the same unique R instance. Example: use Statistics::R; my $R1 = Statistics::R->new( shared => 1); my $R2 = Statistics::R->new( shared => 1); $R1->set( 'x', 'pear' ); my $x = $R2->get( 'x' ); print "x = $x "; Do not call the stop() method is you still have processes that need to interact with R. run() First, start() R if it is not yet running. Then, execute R commands passed as a string and return the output as a string. If your command fails to run in R, an error message will be displayed. Example: my $out = $R->run( q`print( 1 + 2 )` ); If you intend on running many R commands, it may be convenient to pass an array of commands or put multiple commands in an here-doc: # Array of R commands: my $out1 = $R->run( q`a <- 2`, q`b <- 5`, q`c <- a * b`, q`print("ok")` ); # Here-doc with multiple R commands: my $cmds = <<EOF; a <- 2 b <- 5 c <- a * b print('ok') EOF my $out2 = $R->run($cmds); To run commands from a file, see the run_from_file() method. The output you get from run() is the combination of what R would display on the standard output and the standard error, but the order may differ. When loading modules, some may write numerous messages on standard error. You can disable this behavior using the following R command: suppressPackageStartupMessages(library(library_to_load)) run_from_file() Similar to run() but reads the R commands from the specified file. Internally, this method uses the R source() command to read the file. set() Set the value of an R variable (scalar or arrayref). Example: $R->set( 'x', 'pear' ); or $R->set( 'y', [1, 2, 3] ); get() Get the value of an R variable (scalar or arrayref). Example: my $x = $R->get( 'x' ); # $y is an scalar or my $y = $R->get( 'y' ); # $x is an arrayref start() Explicitly start R. Most times, you do not need to do that because the first execution of run() or set() will automatically call start(). stop() Stop a running instance of R. restart() stop() and start() R. bin() Get or set the path to the R executable. is_shared() Was R started in shared mode? is_started() Is R running? pid() Return the pid of the running R process INSTALLATION
Since Statistics::R relies on R to work, you need to install R first. See this page for downloads, http://www.r-project.org/ <http://www.r- project.org/>. If R is in your PATH environment variable, then it should be available from a terminal and be detected automatically by Statistics::R. This means that you don't have to do anything on Linux systems to get Statistics::R working. On Windows systems, in addition to the folders described in PATH, the usual suspects will be checked for the presence of the R binary, e.g. C:Program FilesR. If Statistics::R does not find R installation, your last recourse is to specify its full path when calling new(): my $R = Statistics::R->new( r_bin => $fullpath ); You also need to have the following CPAN Perl modules installed: Text::Balanced (>= 1.97) Regexp::Common IPC::Run SEE ALSO
o Statistics::R::Win32 o Statistics::R::Legacy o The R-project web site: http://www.r-project.org/ <http://www.r-project.org/> o Statistics:: modules for Perl: <http://search.cpan.org/search?query=Statistics&mode=module> AUTHORS
Florent Angly <florent.angly@gmail.com> (2011 rewrite) Graciliano M. P. <gm@virtuasites.com.br> (original code) MAINTAINER
Brian Cassidy <bricas@cpan.org> COPYRIGHT &; LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. BUGS
All complex software has bugs lurking in it, and this program is no exception. If you find a bug, please report it on the CPAN Tracker of Statistics::R: http://rt.cpan.org/Dist/Display.html?Name=Statistics-R <http://rt.cpan.org/Dist/Display.html?Name=Statistics-R> Bug reports, suggestions and patches are welcome. The Statistics::R code is developed on Github (http://github.com/bricas/statistics-r <http://github.com/bricas/statistics-r>) and is under Git revision control. To get the latest revision, run: git clone git@github.com:bricas/statistics-r.git perl v5.12.4 2011-11-22 Statistics::R(3pm)
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy