Starting a Script at System Boot on AIX 7

I want to know how can I start a script at the system startup. I tried to make a sh file under /etc/rc.d/rc3.d/ but I rebooted the Os and it does not start my script as I want. :(.

Regards,
Victor RodriguezAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kenfcampCommented:
If you're looking for it to start at boot up, I believe it needs to be in rc2.d

Also, make sure your script is executable  
# chmod +x <your-script>

Open in new window


Ken
Dr. KlahnPrincipal Software EngineerCommented:
Assuming that your system's cron supports reboot scripts, the easiest way is to have cron execute the script at system reboot.  Then there is no fiddling with system directories involved.

https://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Two general ways.

1) /etc/rc.local (if AIX supports this method).

2) CRON - @reboot path-to-your-script
Carlos IjalbaIT Systems DirectorCommented:
For this kind of things, AIX uses the inittab, no need to fiddle with other methods (although they are supported for compatibility with other UNIX).

To add and remove scripts or commands to the inittab there are specific AIX commands that check the file's integrity (similar to visudo for /etc/sudoers). The inittab resides in /etc/inittab, and it's not recommended to edit it directly.

To see the actual inittab, use the "lsitab" command, to add an entry to the inittab use the "mkitab" cmd, use "man mkitab" to see the options.

Also AIX has rc.startup and rc.shutdown scripts, where you usually place your app startup and shutdown scripts.

For example, Oracle DB startup and shutdown will be put in rc.startup and rc.shutdown scripts, and agents and daemons like nagios NRPE or LPAR2RRD will be put in inittab.

A good post about the different options can be seen on IBM developerworks:

https://www.ibm.com/developerworks/aix/library/au-aix-autostartup-shutdown-scripts/index.html
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.