HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to run some commands automatically before getting login prompt in hp-ux and suse linux

 
SOLVED
Go to solution
senthil_kumar_2
Regular Advisor

how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi

I am using redhat, suse and hpux.

in redhat there is a file called "/etc/rc.d/rc.local". where we can enter the commands. that will be executed whenever the server is booting.


Ex:

# vim /etc/rc.d/rc.local

touch /var/lock/subsys/local

so the file "/var/lock/subsys/local" will be created whenever we are starting the server.



But in suse and hp-ux we are not able to find a file like this.

is it available in suse and hpux?

or how to create this file?



11 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi:

In HP-UX there is no complement to '/var/lock/subsys/local. The HP-UX startup/shutdown paradign is similar to that of Linux (or conversely).

The details for HP-UX can be discovered by reading the manpages for 'rc(1M)' or this (still valid) whitepaper:

http://docs.hp.com/en/B2355-60130/rc.1M.html

http://docs.hp.com/en/934/startup.pdf

Regards!

...JRF...
TTr
Honored Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

To execute commands and start processes during boot up in HP-UX you use the start-up sequence "RC" which was covered in your other thread

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1339765

Mel Burslan
Honored Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

As far as I know, there is no such built-in mechanism (until V11.11, rest ? I'm not sure) but it is very easy to add.

create a script for this purpose in directory /sbin/init.d.

example : /sbin/init.d/localtasks

edit this file and put commands you want running into this newly created file. Make sure owner root has rwx permissions.

then place a symbollic link to the /sbin/rc3.d, pointing to your new script, with a number as high as possible to prevent conflict with other startup jobs.

example:

ln -s /sbin/init.d/localtasks /sbin/rc3.d/S999localtasks

Hope this helps
________________________________
UNIX because I majored in cryptology...
Bill Hassell
Honored Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Be sure to read the link above concerning rc (bootup/shutdown) scripts but also refer to the file: /sbin/init.d/template which is a starting point for creating your start (and stop) commands.


Bill Hassell, sysadmin
Suraj K Sankari
Honored Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi,

You can create your own startup script, 1st you need to decide your script will run which run label according to run label go the directory /etc/rc.d/rc1.d or /etc/rc.d/rc2.d then create a file stat with S and a unique no like S2355 do â ls â lâ you can see other files but remember the no should be unique
Then link that file to your script or you can copy paste your contain or your script into this file save the file change the owner and permission as other files are having.

http://search.hp.com/redirect.html?url=http%3A//forums11.itrc.hp.com/service/forums/questionanswer.do%3FthreadId%3D520675&qt=%2B/etc/rc.d&hit=1


Suraj
senthil_kumar_2
Regular Advisor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi

I checked this with SUSE linux.

But it is not working.

I have done follwoings.

1) First created the file "create" in /etc/init.d.

# cd /etc/init.d
# vi create
#! /bin/sh
cd /root
mkdir soft

2)the permission of the file is

suse10tst:/etc/init.d # ll create
-rwxr-xr-x 1 root root 32 May 21 08:19 create


3) My default runlevel is 5. so i want to run this script in runlevel 5 (/etc/rc.d/rc5.d). so i have create the link in /etc/rc.d/rc5.d

# cd /etc/rc.d/rc5.d
#ln -s /etc/init.d/create S999create

4) The permissoin of the link file is

suse10tst:/etc/rc.d/rc5.d # ll S999*
lrwxrwxrwx 1 root root 20 May 20 14:24 S999create -> /etc/init.d/create

The i restarted the suse.

But The directory "/root/soft" is not created. i am using this script to do this.

Where is problem in my configuratoin.

How to solve this.



Mel Burslan
Honored Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Senthil,

You realize that, you are asking the question in HPUX forum. Right ? Then the answers you will get will be based on HPUX OS. SUSE being a lesser spread Linux variant, may not have too many followers on this forum. You might want to ask this question in a SUse or any other slackware based Linux distro oriented forum. I personally do not know how to accomplish it on SuSE.
________________________________
UNIX because I majored in cryptology...
senthil_kumar_2
Regular Advisor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi Mel Burslan,

As said, the same concept will work in hp-ux?

Are you sure?

How to check this in hp-ux with out restarting the server.

Since i can't restart my hp-ux server.

So that i wanted to implement this in suse linux.

James R. Ferguson
Acclaimed Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi:

As Mel said, you will get better answers for Suse Linux in the Linux formum family:

http://forums11.itrc.hp.com/service/forums/familyhome.do?familyId=118

I suggest that you open a query there. You can reference this thread if you wish, too.

Regards!

...JRF...
senthil_kumar_2
Regular Advisor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Hi

I am closing this thread
Mel Burslan
Honored Contributor

Re: how to run some commands automatically before getting login prompt in hp-ux and suse linux

Senthil,

The process described is for HPUX and will work, provided you do everything right, with file ownerships, permissions and such. Also, since nobody can know your server's start-up sequence, the numbering of S999... link is a suggestion. You need to investigate what you have and may have to modify the number. But I strongly suggest reading the referenced documents rather than taking my or someone else's word as gospel and following it to the last dot without trying to understand the actions in it.

So, yes the method will work but also you will need to do a little bit of studying to make it work.

SuSE Linux and HPUX are two different concepts. So, what works on one, most likely will not work on the other without modifications. So, your "I want to try it on SuSE before I do it on HPUX" does not have any merit. I suggest you talk to the people with money in your organization and get your hands on an older and cheaper HPUX test and development server to play with, crash and burn, then reinstall activities. You can not become an experienced sysadmin, if all you have is a production server, which you can not shutdown without a written permission from god. It is like fighting with your hands tied in your back.
________________________________
UNIX because I majored in cryptology...