|
Home > Archive > Unix Programming > November 2006 > boot
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| sandhu 2006-11-22, 1:39 am |
| i want to run a script that is the first script to be run after
rebooting
where should i add that script.......
like this
a welcome message should be printed after login
i know script ..
but how to make it default........
please help me out,,.........
| |
| Maxim Yegorushkin 2006-11-22, 7:27 am |
|
sandhu wrote:
> i want to run a script that is the first script to be run after
> rebooting
> where should i add that script.......
>
> like this
> a welcome message should be printed after login
> i know script ..
> but how to make it default........
> please help me out,,.........
It may depend on the operating system you are using and shell.
For linux you can invoke your script from /etc/rc.local, it is executed
before login prompt.
For bash shell you can use /etc/profile or ~/.bash_profile, they are
executed after logging in. Please see man for bash or other shell you
happen to use.
| |
| Pascal Bourguignon 2006-11-22, 7:27 am |
| "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
| |
| loic-dev@gmx.net 2006-11-22, 7:27 am |
| Hello,
> like this
> a welcome message should be printed after login
If you just want a message, you could use /etc/motd (message of the
day) or /etc/issue (legal issue regarding usage of the server) and put
your message(s) there.
Cheers,
Loic.
|
|
|
|
|