11-22-06 12:27 PM
"sandhu" <sandesh.aks@gmail.com> writes:
> i want to run a script that is the first script to be run after
> rebooting
> where should i add that script.......
In sysv-like unix, you can put an entry in /etc/inittab to have init
launch it first thing (before the scripts in /etc/init.d/).
Or you could call your script from /etc/init.d/boot first thing.
In bsd-like unix, call your script from /etc/rc.
In both case, you don't have much to do anything with: no file system
to write to, no service, in some distribution, no device. Only a root
file system mounted read-only.
So I don't know what you may want to do at such an early time...
> like this
> a welcome message should be printed after login
This is something totally different.
When you log in with a shell, most shell program will read a startup
script and execute it before giving a prompt.
Depending on your shell,
echo $SHELL
man bash
man ksh
man sh
...
you can write commands in ~/.bashrc ~/.profile ~/.kshrc ~/.bash_login
~/.login etc... The exact file(s) are indicated in your shell manual
page.
> i know script ..
> but how to make it default........
> please help me out,,.........
You need to learn more about unix. Read unix tutorials and unix books...
Also, it will be instructive, knowing that init is the first process
forked by the kernel, to read the its manual page, and from here, to
track down the boot process. (eg, in sysv, read /etc/inittab, and
check each program or script (reading the man page of the commands,
etc), until you reach the login.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we. -- Georges W. Bush
[ Post a follow-up to this message ]
|