Script will keep checking running status of another script and also restart called script at night
I am using blow script :--
crontab entry for this script
now I want this script also kill and restart “snmp_trap.sh” at 11.30PM every day. I am confused, if I am use sleep to within this to kill process(sleep “time”) then it works but this script run on every 5th minute so it again execute sleep command every 5th minute and go on…..
could you please let me know what could be the possible implementation for this….
Last edited by vbe; 11-20-2013 at 05:41 AM..
Reason: Stop use fancy fonts, you have already been told...
Hi,
I have tried with the following code;
if ;then
echo "Failure."
else
echo "Success."
fi
to test the exit status of the test.ksh shell script. But whatever is the exit status of the test.ksh shell script Failure. is always printed.
Please help.
regards,
Dipankar. (2 Replies)
Hi!
I have a script, which calls another script on a remote machine using ssh.
I need to check if the remote running script is succesful. If it is succesful I need to continue the for loop (run it on another machine) or break the loop.
Please let me know if anyone has an idea on checking the... (3 Replies)
hi,
i am new to this scripting stuff so please help.
i need a script that should check network connection while process.bsh is running which connects to a server for some time (e.g. 30 secs to a minute) and I wanted to make sure that network interruption does not happen during this time period... (2 Replies)
Hi,
I have a problem with running out of memory in my Ubuntu web server (4GB RAM) because many people try to access my server.
I used to restart manually my apache server to clear out the memory & swap.
Can anyone tell me how to write bash script that can automatically restart apache when... (2 Replies)
Greetings...
I have to construct shell script to check the SFTP status,
Define a global variable (say sftpStatus). Set it to default value "success" when you define it first time outside the script.
check the current SFTP status (say currentStatus - local variable within the script)
if... (16 Replies)
Hi All
I have written below basic restart script but it is giving me the following error -
error - syntax error at line 40 : `else' is not matched .
below is the script can someone assist me what i am doing wrong -
#!/bin/ksh
cd bin
. ./set_sysm
sleep 60
./swstop -f 0
... (1 Reply)
Hi,
I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help..
i am using below command to run script
nohup system_traps.sh &
but in some... (9 Replies)
I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below.
#masterscript.sh
./callingscript.sh
echo $fileExist
#callingscript.sh
echo "The script is called"... (2 Replies)
#!/bin/ksh
#This script will check status of load balancer in AIX servers from hopbox
#Steps to do as folows :
#Login to server
#netstat -ani | grep <IP>
#check if the output contains either lo0 OR en0
#if the above condition matches, validation looks good
#else, send an email with impacted... (7 Replies)
Hi,
I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed.
Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies
LEARN ABOUT OSF1
wait
wait(1) General Commands Manual wait(1)NAME
wait - Awaits process completion
SYNOPSIS
wait [pid]
Note
The C shell has a built-in version of the wait command. If you are using the C shell, and want to guarantee that you are using the command
described here, you must specify the full path /usr/bin/wait. See the csh(1) reference page for a description of the built-in command.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
wait: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
None
OPERANDS
One of the following: The unsigned decimal integer process ID of a command, for which the utility is to wait for the termination. A job
control job ID that identifies a background process group to be waited for. The job control job ID notation is applicable only for invoca-
tions of wait in the current shell execution environment. The exit status of wait is determined by the last command in the pipeline.
DESCRIPTION
When an asynchronous list is started by the shell, the process ID of the last command in each element of the asynchronous list becomes
known in the current shell execution environment.
If the wait utility is invoked with no operands, it waits until all process IDs known to the invoking shell have terminated and exits with
a zero exit status.
If one or more pid operands are specified that represent known process IDs, the wait utility waits until all of them have terminated. If
one or more pid operands are specified that represent unknown process IDs, wait treats them as if they were known process IDs that exited
with exit status 127. The exit status returned by the wait utility is the exit status of the process requested by the last pid operand.
The known process IDs are applicable only for invocations of wait in the current shell execution environment.
RESTRICTIONS
If wait is called in a subshell or separate utility execution environment, such as one of the following, it returns immediately because
there are no known process IDs to wait for in those environments:
(wait) nohup wait ... find . -exec wait ... ; If the exit status of wait is greater than 128, there is no way for the application
to know if the waited-for process exited with that value or was killed by a signal. Since most utilities exit with small values,
there is seldom any ambiguity.
EXIT STATUS
If one or more parameters were specified, all of them have terminated or were not known by the invoking shell, and the status of the last
parameter specified is known, then the exit status of wait is the exit status information of the command indicated by the last parameter
specified. If the process terminated abnormally due to the receipt of a signal, the exit status is greater than 128 and is distinct from
the exit status generated by other signals. (See the kill -l option.) Otherwise, the wait utility exits with one of the following values:
The wait utility was invoked with no operands and all process IDs known by the invoking shell have terminated. The wait utility detected
an error. The command identified by the last pid operand specified is unknown.
EXAMPLES
Although the exact value used when a process is terminated by a signal is unspecified, if it is known that a signal terminated a process, a
script can still reliably figure out which signal using kill as shown by the following script:
sleep 1000& pid=$! kill -kill $pid wait $pid echo $pid was terminated by a SIG$(kill -l $?) signal. If either sequence of commands
shown on the first two lines is run in less than 31 seconds either of the commands shown on lines 3 and 4 will return the exit sta-
tus of the second sleep in the pipeline:
sleep 257 | sleep 31 & jobs -l %% wait <pid of sleep 31> wait %%
ENVIRONMENT VARIABLES
The following environment variables affect the execution of wait: Provides a default value for the internationalization variables that are
unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari-
ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value,
overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale used to
affect the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the
processing of LC_MESSAGES.
SEE ALSO
Commands: bg(1), csh(1), fg(1), jobs(1), kill(1), ksh(1), sh(1)
Functions: wait(2)
Standards: standards(5)wait(1)