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.

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.

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 .

SIGHUP is not supported under Windows

You could try something like this, but as warned the output may not be useful in anthing but a shell.

command > logfile &
sleep 1
kill -INT $!
sleep 1
kill $!
wait