Application Script didn't run during AIX shutdown using RC directories

Tags
advanced, solved

 
Thread Tools Search this Thread
# 1  
Old 08-23-2018
Application Script didn't run during AIX shutdown using RC directories

Hi,


I am trying to bring down the application gracefully before bringing down AIX OS/LPAR using RC directories.

Issue: Application script is not working properly during/before AIX OS/LPAR shutdown. looks like "rc.d" directories doesn't recognize Kill script.

But Startup script (using rc2.d) is working as expected. When UI reboot the LPAR, as part of "/etc/rc.d/ec2.d/S80app" app script ran in run level 2.


What I have done so far

under "/etc/rc.d"

Code:
drwxr-xr-x    2 root     system          256 Apr 18 2015  rc9.d
drwxr-xr-x    2 root     system          256 Apr 18 2015  rc8.d
drwxr-xr-x    2 root     system          256 Apr 18 2015  rc7.d
drwxr-xr-x    2 root     system          256 Apr 18 2015  rc5.d
drwxr-xr-x    2 root     system          256 Apr 18 2015 rc4.d
drwxr-xr-x    2 root     system          256 Jun 13 2017  rc3.d
-r-xr--r--    1 root     system         1610 Jun 13 2017  rc
drwxr-xr-x    2 root     system          256 Aug 22 14:04 init.d
drwxr-xr-x    2 root     system          256 Aug 22 14:36 rc6.d
drwxr-xr-x    2 root     system          256 Aug 22 14:47 rc2.d


Created a common script under "/etc/rc.d/init.d/"

app.sh


Code:
cat app.sh
#!/bin/ksh
# description: APP startup script

case "$1" in
start )
        /opt/test/mydir/start.sh
        ;;

stop  )
        /opt/test/mydir/stop.sh
        ;;

* )
        echo "Usage: $0 {start|stop}"
        exit 1
esac
[root@test1]/etc/rc.d/rc2.d>



Scenario 1)

Then
created the symbolic links under "/etc/rc.d/rc2.d"

Code:
-r-xr-xr-x    1 root     system          326 Jun 13 2017  Ssshd
-r-xr-xr-x    1 root     system          325 Jun 13 2017  Ksshd
-r-x------    1 root     system         2545 Jun 13 2017  Kwpars
-rwxr-xr-x    1 root     system          175 Jun 13 2017  S00ct_boot

lrwxrwxrwx    1 root     system           24 Aug 22 14:36 S80app7 -> /etc/rc.d/init.d/app.sh
lrwxrwxrwx    1 root     system           24 Aug 22 14:47 K90app7 -> /etc/rc.d/init.d/app.sh

Result: Not as expected
LPAR was shutdown; stop script ran successfully before shutdown.
But Issue is stop script ran again during LPAR activation/restart as well.

My intention is only to run stop script before shutdown and start script after the lpar restart.

Scenario 2)

under "/etc/rc.d/rc2.d"
Code:
-r-xr-xr-x    1 root     system          326 Jun 13 2017  Ssshd
-r-xr-xr-x    1 root     system          325 Jun 13 2017  Ksshd
-r-x------    1 root     system         2545 Jun 13 2017  Kwpars
-rwxr-xr-x    1 root     system          175 Jun 13 2017  S00ct_boot

lrwxrwxrwx    1 root     system           24 Aug 22 14:36 S25app7 -> /etc/rc.d/init.d/app.sh

and
after reading IBM tech note (ref to step 5 in IBM tech note)

IBM Starting and Stopping Software via System V RC Directories - United States


under "/etc/rc.d/rc6.d"
ln -s /etc/rc.d/init.d/app7.sh K70app7

Result: Stop script was not even ran.


even created a directory rc0.d

"/etc/rc.d/rc0.d"
and created symmlink

ln -s /etc/rc.d/init.d/app7.sh K70app7


Result: Stop script was not even ran.

Could you help me fix this issue. I am not sure If am missing anything.


Thank you.

------ Post updated at 03:20 PM ------

update: app7 or app (please ignore those in the post);

But I am using app7 across all places. So its not naming or typo issue.

------ Post updated 08-23-18 at 09:51 AM ------

Update:

Issue has been resolved.
Using /etc/inittab for startup and /etc/rc.shutdown for Shutdown.

------ Post updated at 09:53 AM ------

closing the thread.
This User Gave Thanks to System Admin 77 For This Post:
Neo (08-24-2018)

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
How to run a script/command on all the directories in a directory tree? temp-usr Shell Programming and Scripting 2 10-15-2015 04:15 AM
Run an application in shell script dellanicholson UNIX for Dummies Questions & Answers 3 09-06-2015 05:51 PM
Script to run at start and shutdown saurabh84g Red Hat 2 10-21-2013 05:22 PM
How to run perl script on multiple files of two directories? grace_shen Shell Programming and Scripting 3 09-24-2013 05:22 PM
AIX How to run a Shell Script by changing the User acoomer AIX 4 07-25-2012 02:56 PM
Command script to be run in both AIX and LINUX arjunprathap Shell Programming and Scripting 2 10-12-2011 11:49 AM
How to run perl script in remote machine from java application? bassma Shell Programming and Scripting 1 05-31-2011 01:40 AM
emulate aix 5.3 , how ....? pearpc didn't work prpkrk UNIX for Dummies Questions & Answers 1 04-04-2011 06:50 PM
My script didn't run every run every minute at cronjob ngaisteve1 AIX 4 08-13-2010 02:03 AM
Run perl script on files in multiple directories ad23 Shell Programming and Scripting 8 06-25-2010 01:23 PM
stop application befor shutdown Mr.AIX AIX 2 03-28-2010 02:51 AM
Script to force Oracle database shutdown when shutdown immediate does not work aixhp UNIX for Dummies Questions & Answers 7 03-11-2010 02:04 PM
Application Cleanup during Linux Shutdown whatisron Programming 6 02-12-2010 11:11 AM
is it ok to run AIX mksysb script on vio servers? honeym210 AIX 10 08-15-2008 02:23 PM
run a application from a remote server via script? yankee428 Shell Programming and Scripting 4 10-26-2005 05:11 PM