• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

How to stop a background task that is waiting for user input?

Hi, I scheduled a task that runs a script, and when I imported the script I forgot to remove the "pause" command.  How do I stop the task?  I've tried db2stop, as well as force applications all, but it's still running...  Help!  Thanks.
0
pw05
Asked:
pw05
  • 3
1 Solution
 
ghp7000Commented:
try db2_kill, this will kill the instance, then you can do db2start
0
 
pw05Author Commented:
db2_kill:
Abruptly stops all processes being run on multiple database partition servers and cleans up all resources on all database partition servers. This command renders your databases inconsistent. Do not issue this command except under direction from IBM service.

How would I make the databases consistent again after running db2_kill?
0
 
ghp7000Commented:
run db2start
0
 
ghp7000Commented:
For your future reference:
Checking and working with return code on DB2 Wshell scripts

One way to do return code checking on shell scripts is saving a checkpoint on each step done. You can also stop script execution when and error happens by including the option -s on db2 command call. Here is an example of creating and dropping a db2 table:

Example 9-1 Forwarding return code from sample.db2 script to runtask.bat

-- script SAMPLE.DB2 --

!ECHO 'CONNECTING' > SAMPLE.FLG@

CONNECT TO SAMPLE_B@

!ECHO 'CREATING' > SAMPLE.FLG@

CREATE TABLE SAMPLE (COL_1 VARCHAR(20))@

!ECHO 'DROPPING' > SAMPLE.FLG@

DROP TABLE SAMPLE@

!ECHO 'DISCONNECTING' > SAMPLE.FLG@

DISCONNECT SAMPLE_B@

!ECHO 'OK' > SAMPLE.FLG@

-- end script SAMPLE.DB2 --

-- script RUNTASK.BAT --

db2 -td@ -s -f SAMPLE.DB2 -z SAMPLE.LOG

FIND "OK" SAMPLE.FLG2 > NIL

IF %ERRORLEVEL% != 0 GOTO ERRHAND

ECHO SCRIPT OK

GOTO END

:ERRHAND

ECHO SCRIPT FAIL

:END

-- script RUNTASK.BAT --

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now