Sponsored Content
Top Forums Shell Programming and Scripting Check if trigger Script is running Post 302070388 by mgirinath on Tuesday 4th of April 2006 11:49:18 AM
Old 04-04-2006
Hi,

The solution Alexop gave returns 6 if I am not running the script and returns 7 when I am running I noticed that it is showing all the processes that ran

this is what I get when that command ....
Code:
before running my trigger script ...
ps -ef | grep -v $$ | grep Trigger.sh
user1051  610404 1249490   0 09:29:11  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 1474632 1249490   0 09:30:59  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 2003114 1249490   0 09:27:59  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 2031834 1945810   0 10:02:56  pts/8  0:00 /usr/bin/sh ./Trigger.sh
user1051 2293766 1249490   0 09:46:03  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 2314464 1945810   0 11:34:41  pts/8  0:00 /usr/bin/sh ./Trigger.sh

while running Trigger script...
user1051 233596 1249490   0 09:50:12  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 610404 1249490   0 09:29:11  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 1474632 1249490   0 09:30:59  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 2003114 1249490   0 09:27:59  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 2031834 1945810   0 10:02:56  pts/8  0:00 /usr/bin/sh ./Trigger.sh
user1051 2293766 1249490   0 09:46:03  pts/3  0:00 /usr/bin/sh ./Trigger.sh
user1051 2314464 1945810   0 11:34:41  pts/8  0:00 /usr/bin/sh ./Trigger.sh

This could be because I ran the script for a while and stopped it and ran again, then it counts all the processes including the current one.....
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check that script is not running twice

using ps -ef | fgrep "ld_data" how do i write a script to check that it didn't already run Thanks (2 Replies)
Discussion started by: Link_02
2 Replies

2. Shell Programming and Scripting

Running a check platform script

Hi, I want to run a check platform & application script under ksh (Soaris boxes). It runs some commands and it take some time. I want to customize it like that: - output is too big, hence I want some output of the commands to be redirect ed in an output file (or maybe two or three) - not... (4 Replies)
Discussion started by: heartwork
4 Replies

3. Shell Programming and Scripting

script to check if process is running

How do I make a shell script to see if a certain process is running. The process shows up on ps aux as /usr/sbin/daemon eg: if /usr/sbin/daemon else #nothin basically i want to run the process if it isnt running/ has been stopped. Thanks. (2 Replies)
Discussion started by: daydreamer
2 Replies

4. Shell Programming and Scripting

script to check if another script is running and if so, then sleep for sometime and check again

Hi, I am a unix newbie. I need to write a script to check wheteher another script is still running. If it is, then sleep for 30m and then check again if the script is running. If the script has stopped running then, I need to come out of the loop. I am using RHEL 5.2 (2 Replies)
Discussion started by: mathews
2 Replies

5. UNIX for Dummies Questions & Answers

Help Running a Check in Bash Script

Hey guys, so I wrote a small script that pretty much just takes in two numbers and counts from the first to the second, e.g. unknown-hacker|544> count.sh 1 3 1 2 3 My problem is I want to make it so that if you input invalid parameters, such as non-numerical characters, more than 2... (2 Replies)
Discussion started by: Duo11
2 Replies

6. Shell Programming and Scripting

Script to check running of process

Hi, Can anyone please tell me how to write a shell script to check whether a process if running or not.... if its still running then wait for sometime and if not then run the next query. Also, Under my one main script main.sh I have to run 2 scripts simutaneously which take some time to... (2 Replies)
Discussion started by: lovepujain
2 Replies

7. UNIX for Dummies Questions & Answers

[Solved] How to Check if a script is running?

Hi All, I am new to Unix... Can you please let me know how we can check if a script is running or not on Solaris box? (4 Replies)
Discussion started by: Rahul466
4 Replies

8. Shell Programming and Scripting

Check presence of trigger file

Hi, I make a sftp connection successfully.My requirement is the script shall execute only after i find a trigger file(dailyreport.OK.psv) in the remote dir. If the trigger file is not present ,the script should exit else it should continue with the rest of the scripts statements. Below code is... (13 Replies)
Discussion started by: samrat dutta
13 Replies

9. Shell Programming and Scripting

Check to see if script is already running

Happy New Year Is there a quick way to check to see if a script is already running. I want to put in a check in the script to exit, if already running. Currerntly i can only think of doing it the following way. # ps -ef | grep -i 3_HOUSEKEEPING_FFTVTL_TO_FFTDSSU_DUPLICATION.ksh |... (5 Replies)
Discussion started by: Junes
5 Replies

10. UNIX for Beginners Questions & Answers

How to check if the script is already running?

I have one shell script in NAS shared location. Since NAS is mounted in many servers, script can be run from any of those servers. I want to make sure if the script is already running, it should not allow others to run it. I googled it and got some idea that i can touch one empty file in the... (8 Replies)
Discussion started by: thomasraj87
8 Replies
PTS_QUIT(1)						       AFS Command Reference						       PTS_QUIT(1)

NAME
pts_quit - Exit from pts interactive mode SYNOPSIS
pts quit [-cell] <cell name> [-noauth] [-localauth] [-force] pts q [-c] <cell name> [-n] [-l] [-f] DESCRIPTION
The pts quit command exits from pts interactive mode. The command can be run from the command line or interactively, but on the command line it does nothing and is therefore of questionable utility. CAUTIONS
Prior to OpenAFS 1.4.5 and OpenAFS 1.5.23, the pts quit command was only available on Unix or Linux and when OpenAFS was compiled with the supergroups option (disabled by default). As of OpenAFS 1.4.5 and 1.5.23, it is always available. OPTIONS
Although they have no effect, pts quit takes the following standard pts options: -cell <cell name> Names the cell in which to run the command. For more details, see pts(1). -force Enables the command to continue executing as far as possible when errors or other problems occur, rather than halting execution at the first error. -help Prints the online help for this command. All other valid options are ignored. -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. Do not combine this flag with the -cell or -noauth options. For more details, see pts(1). -noauth Assigns the unprivileged identity anonymous to the issuer. For more details, see pts(1). OUTPUT
This command produces no output. EXAMPLES
Here is an example of a pts interactive session: % pts interactive pts> quit % SEE ALSO
pts(1), pts_interactive(1) COPYRIGHT
Copyright 2007 Jason Edgecombe <jason@rampaginggeek.com> This documentation is covered by the BSD License as written in the doc/LICENSE file. This man page was written by Jason Edgecombe for OpenAFS. OpenAFS 2014-04-08 PTS_QUIT(1)
All times are GMT -4. The time now is 10:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy