04-04-2006
Alexop gave the solution to removing the current process - grep -v $$. Without this the process that runs grep "trigger.sh" always shows up. That is your process - the one looking to see if the script is running.
That means if the other process is not running, you have zero found. In your result, the trigger.sh script is not running. If are you positive it is supposed to be running ALL the time, then not finding it means it is not running. Your result of finding your own process and nothing else also means it is not running.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT CENTOS
dpkg-trigger
dpkg-trigger(1) dpkg suite dpkg-trigger(1)
NAME
dpkg-trigger - a package trigger utility
SYNOPSIS
dpkg-trigger [option...] trigger-name
dpkg-trigger [option...] command
DESCRIPTION
dpkg-trigger is a tool to explicitly activate triggers and check for its support on the running dpkg.
This can be used by maintainer scripts in complex and conditional situations where the file triggers, or the declarative activate triggers
control file directive, are insufficiently rich. It can also be used for testing and by system administrators (but note that the triggers
won't actually be run by dpkg-trigger).
Unrecognized trigger name syntaxes are an error for dpkg-trigger.
COMMANDS
--check-supported
Check if the running dpkg supports triggers (usually called from a postinst). Will exit 0 if a triggers-capable dpkg has run, or 1
with an error message to stderr if not. Normally, however, it is better just to activate the desired trigger with dpkg-trigger.
-?, --help
Show the usage message and exit.
--version
Show the version and exit.
OPTIONS
--admindir=dir
Change the location of the dpkg database. The default location is /var/lib/dpkg.
--by-package=package
Override trigger awaiter (normally set by dpkg through the DPKG_MAINTSCRIPT_PACKAGE environment variable of the maintainer scripts,
naming the package to which the script belongs, and this will be used by default).
--no-await
This option arranges that the calling package T (if any) need not await the processing of this trigger; the interested package(s) I,
will not be added to T's trigger processing awaited list and T's status is unchanged. T may be considered installed even though I
may not yet have processed the trigger.
--await
This option does the inverse of --no-await (since dpkg 1.17.21). It is currently the default behavior.
--no-act
Just test, do not actually change anything.
EXIT STATUS
0 The requested action was successfully performed. Or a check or assertion command returned true.
1 A check or assertion command returned false.
2 Fatal or unrecoverable error due to invalid command-line usage, or interactions with the system, such as accesses to the database,
memory allocations, etc.
ENVIRONMENT
DPKG_ADMINDIR
If set and the --admindir option has not been specified, it will be used as the dpkg data directory.
SEE ALSO
dpkg(1), deb-triggers(5), /usr/share/doc/dpkg-dev/triggers.txt.gz.
1.19.0.5 2018-04-16 dpkg-trigger(1)