Re: Running program at startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2003-07-23 at 15:32, Vij Chau wrote:
> Guys,
> 
> Simple Question. Help appreciated.
> 
> Right now, everytime i start my computer i type "ettercap -sNzC &" in the
> shell and forget it.
> Once in a while, i check the logs.
> 
> How do I automate this at startup?

You can put it at the end of /etc/rc.sysinit

rc.sysinit gets executed once per boot essentially.  rc.local gets
executed at every runlevel change.

A second choice is to make a custom script in /etc/init.d (but you have
to follow a certain form -- see the other init scripts), and then
configure the runlevel to activate that script.  Personally, I'd go with
/etc/rc.sysinit.

Essentially, this is how the boot works:
kernel loads the initial ram disk and runs linuxrc from within this. 
The linuxrc file is usually a script and it loads modules and sets up
all things to access the root file system.  Then it mounts the
filesystem and sets the root file system to be the new system root. 
Then the kernel unloads the ramdisk and looks for /sbin/init and
executes this, which is the mother of all processes (quite literally). 
What follows now, is redhat specific:  

First init processes /etc/inittab and sets up virtual terminals and
things.  If you check /etc/initttab, you'll see that one of the first
things it does (regardless of the runlevel parameter the kernel passed
it) is to execute rc.sysinit:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

Once that is complete, then it executes /etc/rc.d/rc #, where # is the
desired runlevel.  rc runs /etc/rc.local and then causes the init.d
scripts to be run, as appropriate and as configured by you for that
runlevel.  (See /etc/rc[123456].d/*)  

Once that is done, init sets up the gettys (which gives you the login
prompt) on tty1-6.  

Finally, if you are in runlevel 5, init will launch /etc/X11/prefdm
-nodaemon, which fires up X and your login manager.

Other lines in inittab specify handlers for events, like powerfail,
ctrlaltdel, etc.  Just comment out the ctrlaltdel line, for example, and
you can prevent users from rebooting, although there is a better way
which is to add '-a' to the shutdown command which only allows rebooting
if the root user is logged into th console.

Finally a tip:  If you move one of the mingetty lines up to right after
the rc.sysinit line, then you can have a login prompt on one of the ttys
even before the system has completely booted (it will appear after init
finishes rc.sysinit, which is when the "Entering Runlevel #" messag
appears).  This is handy for logging in if one of th init.d scripts
hangs, like network startup or something.

RedHat follows the System V style of init.  Debian is similar but
different, especially in how X is treated.  Gentoo is also different.

This is a long explaination, but understanding the boot process can
really help you know how and where to do things such as what you asked
about.

Michael


> 
> Thanks in advance
> -N
-- 
Michael Torrie <torriem@xxxxxxxxxxxx>


-- 
Shrike-list mailing list
Shrike-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux