Previous Page | Next Page

Getting Started with SAS in UNIX Environments

Exiting or Interrupting Your SAS Session in UNIX Environments


Methods for Exiting SAS

Use one of the following methods to exit a SAS session:


Methods for Interrupting or Terminating SAS

In addition to the methods for exiting SAS, SAS provides methods for interrupting or terminating a SAS session. SAS does not recommend that you use these methods until you have tried to exit SAS by one of the methods listed in Methods for Exiting SAS.

You can interrupt or terminate SAS in the following ways:


Using Control Keys

Control keys enable you to interrupt or terminate your session by pressing the interrupt or quit key sequence. However, control keys can be used only when your SAS program is running in interactive line mode or in batch mode in the foreground. You cannot use control keys to stop a background job.

Note:   You cannot use control keys to stop a batch job that has been submitted with the batch , at , nohup , or cron command.  [cautionend]

Because control keys vary from system to system, issue the UNIX stty command to determine which key sends which signal. The stty command varies considerably among UNIX operating environments, so check the UNIX man page for stty before using the command. Usually, one of these forms of the command will print all of the current terminal settings:

stty
stty -a
stty everything

The output should contain lines similar to these:

intr = ^C; quit = ^\; erase = ^H; 
kill = ^U; eof = ^D; eol = ^@

The caret (^) represents the CTRL key. In this example, CTRL+C is the interrupt key and CTRL+\ is the quit key.

Pressing the quit key is equivalent to specifying the -SIGTERM option on the kill command.


Using the SAS Session Manager

If you invoke SAS in the windowing environment, you can use the SAS Session Manager to interrupt or terminate your SAS session. The SAS Session Manager is automatically minimized when you start SAS. To interrupt or terminate your SAS session, open the SAS Session Manager window and click Interrupt or Terminate.

If asynchronous SAS/CONNECT tasks are running when you terminate a SAS session, these tasks are terminated and no warning message is displayed.

Note:   Clicking Interrupt is equivalent to specifying the -SIGINT option on the kill command. Clicking Terminate is equivalent to specifying the -SIGTERM option on the kill command.  [cautionend]

For more information about the SAS Session Manager, see The SAS Session Manager (motifxsassm) in UNIX.


Using the UNIX kill Command

Note:   Use the kill command only after you have tried all other methods to exit your SAS session.  [cautionend]

The kill command sends an interrupt or terminate signal to SAS, depending on which signal you specify. You can use the kill command to interrupt or terminate a SAS session running in any mode. The kill command cannot be issued from within a SAS session. You must issue it from another terminal or from another window (if your terminal permits it).

The format of the kill command is:

kill <-signal-name> pid

To send the interrupt signal, specify -SIGINT . To send the terminate signal, specify -SIGTERM . Use the ps command and its options to determine the process identification number (pid) of the SAS session that you want to interrupt or terminate.

The results of using the ps command differ in different operating environments. See the UNIX man page for your operating environment for specific information about the ps command and its options. Adding options helps to determine which process you want to kill if you have more than one SAS process running. Also, servers (metadata, OLAP, and so on) leave a process identification number in their start-up directories. You can use this number with the kill command.

The following table lists some of the important kill signals.

Description of Important kill Signals
Signal Option Description
0 SIGNULL Checks access to process identifier
1 SIGHUP Causes SAS to terminate
2 SIGINT Causes SAS to interrupt the session
3 SIGQUIT Causes SAS to terminate and generates a core file
9 SIGKILL Causes a forced termination of the SAS session
15 SIGTERM Causes SAS to terminate

For more information, see the UNIX man pages for the ps and kill commands.


Messages in the SAS Console Log

If SAS encounters an error or warning condition when the SAS log is not available, then any messages that SAS issues are written to the SAS console log. Normally, the SAS log is unavailable only early in SAS initialization and late in SAS termination.

If you are using the -STDIO option, the log is displayed in stderr, and the listing is displayed in STDOUT.

Previous Page | Next Page | Top of Page