LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I automatically start a program at start up? (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-automatically-start-a-program-at-start-up-102154/)

victordh 10-09-2003 01:29 PM

How do I automatically start a program at start up?
 
I'm new to this linux thing. Anyone has an answer?

david_ross 10-09-2003 01:36 PM

Welcome to LQ.

Try adding the command to:
/etc/rc.d/rc.local

If it is to run in the background then put a space then an ampersand afetr it " &".

if you want to run a gui app after you have logged in then look at the session configuration for your window manager.

slightcrazed 10-09-2003 02:09 PM

There are many different ways to run something at startup. I got frustrated a while ago with this same problem (trying to run a couple of X programs at startup) so I just decided to throw this into my .bash_profile:

Code:

ses=$(printenv | grep DISPLAY)
if [ -n "$ses" ]; then
'proggies and scripts you wanna run'
fi

it was a pretty :newbie: workaround at the time, but hey it works, and as the saying goes, if it ain't broke, don't fix it.

slight

Skyline 10-09-2003 02:12 PM

One way for a GUI app with KDE - just create a symlink from the application itself and put it in

/home/your_username/.kde/Autostart

for example -

ln -s /usr/bin/kspread /home/your_username/.kde/Autostart

mohdshakir 02-13-2009 01:30 AM

For gnome
 
The following method is for Gnome;
http://www.techrecipes.net/applicati...ram-on-startup

routers 02-15-2009 10:29 PM

this is what i have from my laptop

for /etc/rc.local
Code:

#!/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.

touch /var/lock/subsys/local
/etc/startup.sh

and for /etc/startup.sh
Code:

#!bin/sh
ifup eth1 &
ifup eth0 &
/sbin/service sshd start &
export http_proxy=localhost:4222
/etc/init.d/cups start &
/etc/init.d/irda start &
/etc/init.d/pcscd start &
/etc/rc.d/init.d/autofs start &
/etc/rc.d/init.d/crond start &
/etc/rc.d/init.d/fuse start &
/etc/rc.d/init.d/netfs start &
/etc/rc.d/init.d/cpuspeed start &

hope you can get idea with this

mohdshakir 02-15-2009 10:42 PM

Or try this for KDE:
http://www.techrecipes.net/applicati...ram-on-startup

and this for starting a program even before the login prompt;
http://www.techrecipes.net/operating...ram-on-startup

AcmeUK 10-27-2013 06:02 AM

Don't forget the CRON
 
Hi

I know this is an old thread but I think this is a good place to higlight using CRON for this.

If you use the @reboot cron keyword, this will execute the specified command once every time the machine is booted.

Hope this help someone.


All times are GMT -5. The time now is 12:57 PM.