Could not get script name running from ps -ef command ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Could not get script name running from ps -ef command ?
# 1  
Old 12-13-2010
Could not get script name running from ps -ef command ?

hi..

i have one perl script called sendsms.pl. After i execute the perl script as background process and run ps -ef, it did not display the filename. It was display as "/usr/bin/perl". How could execute the perl program and display the filename using ps command ?

Code:
#./sendsms &
#ps -ef |grep send
#ps -ef |grep perl
xxxx   1234   640  2  Dec 11  /usr/bin/perl

Thank you,
baharin
# 2  
Old 12-13-2010
ps -ef command will show all the processes including background processes also. There may be a case your script completes its execution before u fire ps -ef | grep send command. So, can u show your perl script to us for getting the exact idea about your problem.
R0H0N
# 3  
Old 12-13-2010
hi...

my script as below:-
Code:
#!/usr/bin/perl -w

use warnings;
use strict;
use POSIX qw(floor);
use POSIX qw(strftime);

my $exp = strftime "%d/%m/%Y %H:%M:%S", localtime(time + 86400);
my $data;

print ("...SMS GATEWAY START...\n");
while (1) {
	if (-e "/cygdrive/c/Inetpub/ftproot/CSV_SMS.csv") {
		system("/cygdrive/c/CLISMS.exe /port=1 /ussd=*122#");
		my $credit = qx(cat /cygdrive/c/Log.txt |grep \"Baki\" |tail -1 |cut -d, -f1);
		$credit =~ s/Baki: //g;
		my $val = "$credit";
		$val =~ s/\s//g;
		$credit = floor($credit + 0.5);

		if ($credit < 10) {
		system("/cygdrive/c/CLISMS.exe /port=1 /to=0133034931 /msg=[SMS Gateway] URGENT!! Current prepaid credit is RM$val. Please reload");
		system("/cygdrive/c/CLISMS.exe /port=1 /to=0193301010 /msg=[SMS Gateway] URGENT!! Current prepaid credit is RM$val. Please reload");
		}

		open (LOG, ">> /cygdrive/c/Inetpub/ftproot/sms.log");
		open (TEXT, "/cygdrive/c/Inetpub/ftproot/CSV_SMS.csv");
		while ($data = <TEXT>) {
		  chomp($data);
		  next if ($data =~ /TelNo/);
		  my ($num,$msg) = split(/;/, $data);
		  system("/cygdrive/c/CLISMS.exe /port=1 /to=$num /msg=$msg");
		  print(LOG "$exp,$num,$msg\n");
		  sleep 60 if $. % 10 == 0;
		}
		close (TEXT);
		close(LOG);
		system ("rm /cygdrive/c/Inetpub/ftproot/CSV_SMS.csv");
	}
	sleep 5;
}

# 4  
Old 12-13-2010
In your post #1 u have written

Code:
$ ./sendsms &

So, is it a shell script which is a wrapper script to call your sendsms.pl program?

Anyway, write perl keyword where u execute your perl program.

Code:
perl sendsms.pl

Then program name can be displayed using ps -ef | grep perl command.
R0H0N
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need a Bash script for iterating thru an array and running a command

Hi , I am a total beginner so bear with me. I have the below code which works . I need to extend it by iterating thru the array arr and executing a command in each loop. some thing on the lines of below. I need to run this in a Jenkins script , so I would need below bash script to run... (6 Replies)
Discussion started by: SVRao19056
6 Replies

2. Shell Programming and Scripting

ps command showing full code of running script

Hi, I have a script running while rsync command is fired to push some files. The output of rsync cmd has been redirected to the script which is used to generate log files containing progress info with formatting. when I enter ps -ef | grep rsync it shows the full scripting code on the cmd line... (2 Replies)
Discussion started by: rajeevra
2 Replies

3. UNIX for Advanced & Expert Users

Running ksh script from command line

Hi. I have a ksh script I want to run, but I'm connecting through a telnet and I don't want to FTP the scripts itself. is there a way of running the script from command line ? like ksh "The script itself..." Thanks, Ramon (4 Replies)
Discussion started by: mellowcandle
4 Replies

4. Shell Programming and Scripting

Running at command - Parent script getting killed

I have a script that calls another script within it that takes about 1 hour to execute. I am noticing that the parent script that calls the child script is getting killed. Does anyone know why? The child script still runs. (3 Replies)
Discussion started by: 3junior
3 Replies

5. Shell Programming and Scripting

running shell command in Perl script

Does not work. #!/usr/bin/perl $etcdir = 'ls -l /etc'; print $etcdir; #END ------------result-------- #perl -w abc123.pl ls -l /etc # This method works. #!/usr/bin/perl $etcdir = system("ls -l /etc"); print $etcdir; #END (2 Replies)
Discussion started by: dplinux
2 Replies

6. UNIX for Dummies Questions & Answers

A command in a script not running in Crontab.

Hi, I made this script for TRU Unix 5.1 OS based Node. When the script was run manually all the commands were running properly. But when it was run from Crontab, one command is not running. This command is not running when the script is running from Crontab: #... (2 Replies)
Discussion started by: mystition
2 Replies

7. Shell Programming and Scripting

Running function or command concurrently in a bash script

I currently run a script over a vpnc tunnel to back-up my data to a remote server. However for a number of reasons the tunnel often collapses. If I manually restore the tunnel then the whole thing can continue, but I want to add into my script a section whereby while the transfer is taking place,... (8 Replies)
Discussion started by: dj_bridges
8 Replies

8. Shell Programming and Scripting

Command Not running in script

Hi Everyone , have a nice day root@sdp01a>SS7Manager -status the problem with above given expression is that i cant add it in script , it only executes if manually given at remote node , can anyone tell me some way to run it in scripts , also i have few more commands aswell , which are for... (2 Replies)
Discussion started by: Dastard
2 Replies

9. Shell Programming and Scripting

running multiple rsh command in a script

hi scripting experts, juz wondering if it's possible to have multiple rsh command in a single script? :confused: ie: rsh -l <username> "<command>" rsh -l <username> "<command>" thanks. regards, wee :) (0 Replies)
Discussion started by: lweegp
0 Replies

10. Shell Programming and Scripting

Running a command or script as root

I'm writing an application (Progress language) that needs to: 1) load the contents of a cron table into the Progress application; 2) display this information in a human manner and allow a select group of people to update it (these people are logged in as themselves, not as root); 3) save... (3 Replies)
Discussion started by: rm-r
3 Replies
Login or Register to Ask a Question