Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stoping AIX subsystem

Status
Not open for further replies.

Tankzeu24

Programmer
Feb 26, 2020
1
BG
I am trying to stop a subsystem. Here how the subsystem is defined:

mkssys -s mytest -p "/home/tester/testServices/bin/test/script.sh" -a "start" -u 0 -R -Q -d -S -n 9 -f 15

Now the `script.sh` is the following script:
```
#!/bin/bash


PRINT_SCRIPT=/home/tester/testServices/Screen.sh
LOG_FILE="/home/tester/testServices/bin/test/log.txt"


echo "Begin script" >> "$LOG_FILE"



trap sigquit 9 15
sigquit()
{
# set -x

echo "Stop case" >> "$LOG_FILE"
exit 0
}



case "$1" in

start)
echo "Starting screen.sh" >> "$LOG_FILE"
$PRINT_SCRIPT

;;
stop)
echo "Stopping screen.sh" >> "$LOG_FILE"
PID=`ps -ef | grep screen.sh | grep -v grep | awk '{print $2}'`
kill -9 $PID
;;
*)
echo "USAGE " >> "$LOG_FILE"

echo "Usage: {start|stop}" >&2
exit 1
;;
esac
exit 0
```

My question is when the subsystem is started via `startsrc -s mytest` and then `stopsrc -s mytest` is called, why isn't `sigquit()` function or the stop) case invoked. It starts successfully (via `startsrc -s mytest`) and it logs "Starting screen.sh", however it seems that the the `stopsrc -s myservice` doesn't invoke the `script.sh`. Any ideas why? If someone can explain how the shell script understands from the stopsrc -s <service-name> to stop it will be perfect !


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top