Always pass SIGINT in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Always pass SIGINT in ksh
# 1  
Old 11-30-2012
Always pass SIGINT in ksh

The following command will run and wait for input from the user.

/usr/sap/SAP/webdisp/wdispmon pf=/usr/sap/SAP/webdisp/profile

What I would like to do is (in one command):
- Add the above line to a ksh script
- Receive the output
- and send a SIGINT

I have seen many posts on how to catch a SIGINT with trap but I want to run this from cron and always send a SIGNT to the command.

Any help would be greatly appreciated.
# 2  
Old 11-30-2012
These are interactive commands; capturing their output may not actually give you anything readable. We frequently get asked about capturing top and other similar commands. They print escape sequences to jump all over the terminal and their captured output is hard to view in anything but a terminal.

If I had to do this, I'd either do this with the expect language, which is designed to wrangle interactive commands this way -- you could actually operate the menus with it, and quit properly -- or hunt deeper into the documentation for these commands to find a commandline switch which does what you want.

Last edited by Corona688; 11-30-2012 at 11:33 AM..
# 3  
Old 11-30-2012
I found the following link so I think it is possible to add it to a shell script. However it does not really give much detail.

Use

You can send operating system signals to the ICM and the SAP Web Dispatcher in order to execute functions. This is useful if you want to administrate the ICM or the Web Dispatcher from a shell script. The functions are provided in the ICM monitor (for the ICM) or the Web admin interface (ICM and Web Dispatcher).
More information:
Procedure

The following table lists the signals and their effect on the ICM / Web dispatcher.
Signals and Their Actions
Signal
Action
SIGINT
Downloads
SIGUSR1
Reduces trace level
SIGUSR2
Increases trace level
SIGHUP
Invalidates buffers: host name buffer and server cache
The Web dispatcher updates its configuration of active servers, details of groups, and URL prefixes. Either it gets the information from the message server or from a local file.
You can do the same from the context menu in the .
Image
SIGHUP is not supported under Windows
# 4  
Old 11-30-2012
You could try something like this, but as warned the output may not be useful in anthing but a shell.
Code:
command > logfile &
sleep 1
kill -INT $!
sleep 1
kill $!
wait

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pass and read an array in ksh shell script function.?

I'm able to read & print an array in varaible called "filelist" I need to pass this array variable to a function called verify() and then read and loop through the passed array inside the function. Unfortunately it does not print the entire array from inside the funstion's loop. #/bin/ksh... (5 Replies)
Discussion started by: mohtashims
5 Replies

2. Shell Programming and Scripting

ksh script trying to pass a variable to edit a file

I'm trying to create a ksh script that will ask the user for the port number. $PORT1 is the variable I want to use that will contain whatever numbers the user inputs. The script would edit ports.txt file, search and delete "./serv 110.1.0.1.$PORT1 200;=3" . So if the user types 50243 then the... (5 Replies)
Discussion started by: seekryts15
5 Replies

3. UNIX for Dummies Questions & Answers

How to pass a parameter to an alias in ksh?

I want to do something like this: alias cd2="cd /data_saves/$(/opt/bin/util/getcustdb -i $@)" Where /opt/bin/util/getcustdb is an inhouse script to lookup customer db name based on a provided id number Then when I use the alias I can cd2 4567 and have it run "/opt/bin/util/getcustdb -i... (3 Replies)
Discussion started by: JourneyRider
3 Replies

4. UNIX for Dummies Questions & Answers

SIGINT issue

May i know what are the possible causes for SIGINT other than ctrl-c? Thanks (17 Replies)
Discussion started by: pandeesh
17 Replies

5. Shell Programming and Scripting

Pass a DDL statement to a KSH script

I need to pass a DDL statement into a ksh script & parse the statement. What is the best way to pass a DDL statement into a KSH script. ---------- Post updated at 09:28 AM ---------- Previous update was at 07:35 AM ---------- if the name of the script is test.ksh test.ksh "ALTER TABLE... (12 Replies)
Discussion started by: gayathree
12 Replies

6. Shell Programming and Scripting

AIX ksh: how to pass variable to host shell

I have a script that "runs" a script. For example: ./runscript.ksh pcnmc01.ksh runscript puts pcnmc01.ksh into the background with log output going to the logfile. After executing the command, I get this output: Running script in the background: pcnmc01.ksh Logfile:... (2 Replies)
Discussion started by: Eben Yong
2 Replies

7. Shell Programming and Scripting

ksh variable pass to awk

I'm trying to store the response from a nawk command inside of a ksh script. The command is: text=$(nawk -F: '$1 ~ /${imgArray}/ {print $2}' ${etcDir}/captions.txt) From what I can tell, the imgArray variable is not being expanding when it is inside the single quote ('). Is there something I... (4 Replies)
Discussion started by: meman1188
4 Replies

8. Shell Programming and Scripting

How to pass ksh array to oracle

Hi all.. Does anyone know have an example of passing the contents of a ksharray to oracle? basically I am looking to loop through the contents of a file and store each line into a bash ksh. Once i have this I can then pass the array into an oracle procedure that accepts an array as an... (1 Reply)
Discussion started by: kiranlalka
1 Replies

9. Programming

Problem with handling SIGINT

For a program I am designing, which involves handling the keyboard input Ctrl^c (SIGINT), it is taking ages for the program to actually recognise and perform the corresponding action whenever I run it and hit Ctrl^C at the CL. I have to do at least 3 Ctrl^Cs before the program will actually... (3 Replies)
Discussion started by: JamesGoh
3 Replies

10. Shell Programming and Scripting

How to pass variable to SQLPLUS in a ksh script?

Hi, I am writing a ksh script which will use sqlplus to run a sql and pass 2 variables as the SQL request. In the ksh script, I have 2 variables which are $min_snap and $max_snap holding 2 different numbers. Inside the same script, I am using SQLPLUS to run an Oracle SQL script,... (6 Replies)
Discussion started by: rwunwla
6 Replies
Login or Register to Ask a Question