How to ADD signal stop commands in Shell Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to ADD signal stop commands in Shell Script
# 1  
Old 03-11-2010
How to ADD signal stop commands in Shell Script

Hi ,

I do have a shell which test the connectivity using ssh, soon after the login it should use the keys Ctrl + z or Ctrl + c to exit from login promt. So how do i need to implement these .
# 2  
Old 03-11-2010
If only test the SSH connect, you can run ssh with command

Code:
echo "========ssh $userid@$servername ls========"
ssh $userid@$servername ls

And set a timeout in sshd_config, if the server is not avaiable.
# 3  
Old 03-11-2010
Use
Code:
kill -17 <pid>  # for Ctrl +z 
kill -2 <pid>  # for Ctrl+c

# 4  
Old 03-15-2010
Need to pull the set of data from a file on a hourly basis

Thanks a lot for your valuable answers

Last edited by raghunsi; 03-15-2010 at 03:12 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Signal out from fork()'d shell script back to the C++ application

Hi, I am writing a C++ application; in which at one point I fork() a new process, which executes a shell script (via execv() call). Now the shell script can take a while to finish (tarring, burning a cd, etc.) and I would like to update the parent application about the progress (while the script... (3 Replies)
Discussion started by: mirni
3 Replies

2. AIX

Shell script stop working

I have a strange problem. I have the following in a cron to find files older than a day. find /dir1/dir2/ ! -name . -prune -name "s*.txt" -type f -mtime +1 -exec echo {} \; | wc -w It was working fine for the last few days now it suddenly stopped working. I can clearly see files in the... (5 Replies)
Discussion started by: bbbngowc
5 Replies

3. Shell Programming and Scripting

How trap a signal in shell script?

Hi , i have a scenario where...i have to put a check where if script is executing more than 15mins i have to kill that script and n retry again 2nd time. i this case i can use background process to do it but i feel trap will be the efficent way to do so... but i dont know much about it... (1 Reply)
Discussion started by: crackthehit007
1 Replies

4. Shell Programming and Scripting

Stop! (the countdown!) :-) shell script help

Hi guys, I've found two nifty little scripts on these forums one which detects if the F5 key has been pressed: #/bin/sh _key() { local kp ESC=$'\e' _KEY= read -d '' -sn1 _KEY case $_KEY in "$ESC") while read -d '' -sn1 -t1 kp do _KEY=$_KEY$kp ... (0 Replies)
Discussion started by: rich@ardz
0 Replies

5. Shell Programming and Scripting

Help with stop/start Shell Script.

Hi All, I would like to develop a shell script for stop & start an application server (1-4) on Solaris box. Here are the user requirements for this task. 1. User will input the option which server they wish to stop. 2. Will clear cache files from specific location. 3. ... (1 Reply)
Discussion started by: venga
1 Replies

6. UNIX for Dummies Questions & Answers

Script triggering Korn shell, how-to stop it?

Script_A.sh has echo "In am in script A" ksh ## K-shell is invoked. Script B.sh ## which I am writing... ./script_A.sh echo "I am in script B" return 0 When I run: $> Script_B.sh $> I am in script A $> Basically, on calling Script_A.sh from within Script_B.sh I have the issue of... (2 Replies)
Discussion started by: baivab
2 Replies

7. UNIX for Dummies Questions & Answers

Stop a shell script

Hi, I am writing a bash shell script. How can I tell it to stop. For example, I would like to have something similar to the following: mike=1 if ; then STOP THE SCRIPT fi (3 Replies)
Discussion started by: msb65
3 Replies

8. Shell Programming and Scripting

stop Prstat using shell script

How to stop the Prstat using shell script ? because after i run the below script the thing seems to be always in loop and cannot get out till i ctrl + c, is there anything that i can add in the script to make it terminate ? <code> #!/bin/sh prstat -Tc -u testing > testing.txt </code> ... (19 Replies)
Discussion started by: filthymonk
19 Replies

9. UNIX for Advanced & Expert Users

signal handling in shell script

Hi can any please tell me is it possible to catch the signal in a shell script like we do in C. if yes please give me some idea or a link. (4 Replies)
Discussion started by: Raom
4 Replies

10. Shell Programming and Scripting

shell script signal handler

AIX 4.3.3 I am trying to write a signal handler into a ksh shell script. I would like to capture the SIGTERM, SIGINT, and the SIGTSTP signals, print out a message to the terminal, and continue executing the script. I have found a way to block the signals: #! /bin/ksh SIGTERM=15 SIGINT=2... (2 Replies)
Discussion started by: jalburger
2 Replies
Login or Register to Ask a Question