How to write a program runs in boot time??

Hi,

I would like to create a program which runs in boot time...how can I do so?



Xenia
xenia27Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lynxlupodianCommented:
Nothing special is needed in the program itself, you just add it to the boot level to execute, when it's finished. This procedure varies from distro to distro, but is nothing hard.

Although, you usually execute things after the boot level.
0
EinarThCommented:
1) write the program

2) start it via one of the bootup scripts in /etc/rc.d or via /etc/inittab

The question isn't really overly clear tho....
0
wesly_chenCommented:
Hi,

> program which runs in boot time
Say the program you create: /usr/local/bin/testprgm

Add
/usr/local/bin/testprgm
into

/etc/rc.d/rc.local     for (Fedora/RedHat)
/etc/rc.d/boot.local  (SuSE)
/etc/init.d/local  (Debian) (If not there, create one with first line "#!/bin/sh" )

Regards,

Wesly
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

avizitCommented:
Your  need might be different ,
you can have two things

1. Program to run during boot
2. program to run when you login

for 1) i.e  for the program to run during boot , you can use what wesly have said
for 2) i.e for the program to run when you login , read

http://www.hk8.org/old_web/linux/run/ch04_15.htm

just wanted to let you know , cos most of time you want something to run only when you login , say for example to set some environment variables etc .If that is so you may not want to run it everytime you boot.
0
xenia27Author Commented:
If I want to make my program run in background constantly, what should I do in my main?
0
avizitCommented:
then you would probably want to write a daemon , http://www.linuxprofilm.com/articles/linux-daemon-howto.html

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wesly_chenCommented:
Yes, daemon in Unix/Linux is like the "service" in Windows, it resides in memory after it runs.
Daemon can start at boot time as the method I mentiooned.

Wesly
0
xenia27Author Commented:
Thanks for the information...Is there more web site I can study??
0
avizitCommented:
0
xenia27Author Commented:
Thanks for your helps~~~  ^^
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.