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


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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:
Login or Register to Reply

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

More UNIX and Linux Forum Topics You Might Find Helpful
Run an application in shell script
dellanicholson
I run the following command using the command line. I need to run the same command in shell script : ./sas.server start start is a parameter that passes to start.server to startup services within start.server. the path to sas.server is /path/Lev1 Here is my code: #!/bin/sh set...... UNIX for Dummies Questions & Answers
3
UNIX for Dummies Questions & Answers
Script to run at start and shutdown
saurabh84g
Hello, I have script that start and shutdown the application. where should i place my script so that it can execute at my OS shutdown ? Pls help me...... Red Hat
2
Red Hat
emulate aix 5.3 , how ....? pearpc didn't work
prpkrk
how to emulate aix 5.3 i had try pearpc , but it didn't work ... someone have some solution? thanks... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers
My script didn't run every run every minute at cronjob
ngaisteve1
In my cronjob, I would like to schedule my script.sh to run every minutes. I crontab -e and have in line below but it didn't seems to run at all. * * * * * script.sh When I run it manually, I can run it. Is that anything wrong with the above line? If I change it to something like below,...... AIX
4
AIX
run a application from a remote server via script?
yankee428
I have a ksh script that does a bunch of things, then runs telnet server_b I then manually login, manually run one command (which launches an application with display back to my workstation), then logout at which point the main script takes back over, runs something else, then ends. Is...... Shell Programming and Scripting
4
Shell Programming and Scripting
UNIX and Linux

Unix (trademarked as the UNIX certification mark) is a very mature family of multitasking, multiuser computer operating systems that evolved from the original AT&T Unix. Unix development starting in the 1970s by legendary Bell Labs programmers Ken Thompson, Dennis Ritchie, and others. Unix was first targeted for the Bell System and AT&T licensed Unix to outside parties. In the 1970s time period, this lead to a variety of for-profit as well as not-for-profit Unix variants.
In the early days, this included the University of California, Berkeley (BSD), Microsoft (Xenix), IBM (AIX), and Sun Microsystems (Solaris). In the early 1990s, AT&T sold their Unix rights to Novell. In 1995 Novell sold their Unix business to the Santa Cruz Operation (SCO). The UNIX trademark was passed to The Open Group, a "neutral" industry consortium. The Open Group promoted the use of the UNIX trademark for certified operating systems that comply with the Single UNIX Specification (SUS). In 2014 Apple's macOS became the Unix version with the largest global install base and macOS remains the largest Unix-user base today.
Linux is a family of open source Unix-like operating systems based on the Linux kernel. The Linux kernel is an operating system kernel first released by Linus Torvalds on 17 September 1991. Linux distributions include the Linux kernel, system software and libraries. Popular free open source Linux distributions include Debian, Fedora, and Ubuntu. Commercial Linux distributions include Red Hat Enterprise Linux and SUSE Linux Enterprise Server. Linux may be freely modified and redistributed. Anyone on the planet may create a Linux distribution for any purpose.
Please enjoy and help our forum community by "showing your work" and posting your code, even when your code is not working as expected. To help others help you, please wrap your code blocks, sample input, sample output, error messages, and other data in CODE tags and wrap your short commands and short data objects in ICODE tags. We were all beginners in the beginning. If you have any questions about how to register or how to post, please contact us in Live Chat. Thank you and enjoy this "forever free" technical support community for UNIX, Linux and computer information technology in general.