Jump to content
xisto Community
djXternal

How To Start A Program On Startup With Options

Recommended Posts

Well as I;ve said before I'm new to linux, but am learning fast, I'm trying to figure out how to add a program to start at fedora bootup, I need '/opt/lampp/lampp start' to start at bootup, I beleive I need to do something in the init.d folder but I am unsure of what should be done

Share this post


Link to post
Share on other sites

You could also add a line in /etc/inittab. it's an old way of doing that kind of things.The line I would add is :Yordansays:2:once:/opt/lampp/lampp start >/tmp/lmapp_start_listing.txt 2>&1Just edit /etc/inittab and add this line at the end. This line has a title ("Yordansays") and asks at initlevel 2 (which is the multi-user level) to start only once (the "Once" field) the command /opt/lampp/lampp start and record the standard output of this command, as well as the standard error of this command, in the file named /tmp/lmapp_start_listing.txt for future debugging if necessary.You could alternatively use /dev/console instead of the txt file, so the result would go to the console at boot time instead of going in a file.

Share this post


Link to post
Share on other sites

The Preffered way of doing somthing like that is with the 'local' boot script.The Local Boot Script is an empty script that always runs last dureing bootup.its there specifically for users to enter any commands they want to run dureing bootup.In my opinion, its better to put applications like this in local, mainly because any resources that the program may need ( for example networking, or the Graphical User Interface ) will be definalty be up and running.ALSO....if you make a mistake in the local script, it does not matter..however a mistake in innitab could prevent the system from booting.(easy to fix, but annoying)the local script is in differant places in differant distro'shave a look in /etc/ and its sub-directories.maybe /etc/initd.d/localGood Luck.

Share this post


Link to post
Share on other sites

Well as I;ve said before I'm new to linux, but am learning fast, I'm trying to figure out how to add a program to start at fedora bootup, I need '/opt/lampp/lampp start' to start at bootup, I beleive I need to do something in the init.d folder but I am unsure of what should be done

 


The preffered way, used by distro, is to create start script and locate it in /etc/init.d/

Simpest method is to copy one of existing one and edit to suit your needs.

Then run chkconfig --add name

You now can activate\deactivate your sirvice at any time by setup utility or any other standart method.

Share this post


Link to post
Share on other sites

i dont really know if it really works for fedora but it sure works for slackware.edit your /etc/rc.d/rc.local and add the program and the options you want to run on startup.

It works for sure. But this method have disadvanteges: you can't manually stop this program at any time just typing /etc/init.d/program stop, or by special Red Hat script - service: service program stop. You can't activate/deactivate such a program by system tools like chkconfig or setup Red Hat utility. This program will not run correctly according to system 'run level'.
This method of running program at startup have exactly one advantage - it's simple. :)

Share this post


Link to post
Share on other sites

It works for sure. But this method have disadvanteges: you can't manually stop this program at any time just typing /etc/init.d/program stop, or by special Red Hat script - service: service program stop. You can't activate/deactivate such a program by system tools like chkconfig or setup Red Hat utility. This program will not run correctly according to system 'run level'.This method of running program at startup have exactly one advantage - it's simple. :)

Correct. Don't remember for Fedora, but rc.local is in RedHat, and RedHat is usually similar to fedora.
I usually prefer /etc/inittab, but rc.local has to work.
Here is what is said in the rc.local file in RedHat :

#!/bin/sh#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

So, this script is exactly here for that purpose. You put in this script what you want to be started at the end of the system boot, and it should be perfect.

Share this post


Link to post
Share on other sites

It works for sure. But this method have disadvanteges: you can't manually stop this program at any time just typing /etc/init.d/program stop, or by special Red Hat script - service: service program stop. You can't activate/deactivate such a program by system tools like chkconfig or setup Red Hat utility. This program will not run correctly according to system 'run level'.This method of running program at startup have exactly one advantage - it's simple. wink.gif


I generally use this method to modprobe the modules so i don't really have to terminate the program. But let me make it clear, if i start a program editing rc.local i can't stop it with "kill pid" ??? hmm that sounds pretty awful in some cases but great for some other cases ;) if you know what i mean ;)

Share this post


Link to post
Share on other sites

i might install linux, the thing is though from what i heard you code everything in command prompt to do stuff like to get an icon shortcut on your desktop to open a program you would have to do a command.To me this sounds like boring, hard and a bad operating system. I like the way it's free though and i might use debian on linux so i can host my own site ;)-Lewis

Share this post


Link to post
Share on other sites

Using Fedora 7, the /etc/rc.d/rc.local method is fine for me, because I need execution of 'amixer Mic,0 cap' to set my microphone to capture device, since every time my system boots it reverts back to capture from Line In.-Axtroz

Share this post


Link to post
Share on other sites

please clarify my doubt

How To Start A Program On Startup With Options

 

 

I have a perl script written and is saved at /root/script.Pl.I want to run the script at boot up. It is required to add the script to /etc/rc.Local.

 

Should I copy paste entire script there or just the path? what are the steps to run the script at start up?

 

Thank you in advance

 

 

 

-reply by nichol

Share this post


Link to post
Share on other sites

Replying to LewisthemusicianNECROTHREADING! lmao.So naive... There is still some drag and drop lol. If you want to do everything by console don't install an x desktop :-) sure Linux is harder to learn than windows and ill admit I still turn to google for a bit of help but not every single thing has to be done in the (often helpful) console. If your app doesn't start through the menu doing it through the console can show you why

-reply by Rezzy

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.