Operating System - HP-UX
1752790 Members
6601 Online
108789 Solutions
New Discussion юеВ

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 11
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...