Howto automatic run/start a program at startup?

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Howto automatic run/start a program at startup?

Postby janpihlgren » Apr 14th, '13, 06:03

I'm using Mageia 2 x86-64.
When I start the computer I whish to run a program automatic (no need to do any manual action).
I have found out that I have to put the command in one of the directory /etc/rc0.d - /etc/rc5.d.
rc6.d looks like to be used when shutdown the computer.
I think the commandname has to begin with Snumber. The command with the highest number will start last.
I have looked in both rc3.d and rc5.d.
In rc3.d, rc4.d and rc5.d there are a some commands that already start with S99.

First: Can I have my startcommand beginning with S99?
Second: In which directory?
User avatar
janpihlgren
 
Posts: 294
Joined: Mar 30th, '11, 12:23
Location: Marsta, Sweden

Re: Howto automatic run/start a program at startup?

Postby isadora » Apr 14th, '13, 08:18

Would give it a try with:
System Settings->System Administration->Startup and Shutdown->Autostart->Add
Program...
..........bird from paradise..........

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupéry
User avatar
isadora
 
Posts: 2766
Joined: Mar 25th, '11, 16:03
Location: Netherlands

Re: Howto automatic run/start a program at startup?

Postby djennings » Apr 14th, '13, 10:08

If you want a service to start at boot then you put a startup file in /etc/rc.d/init.d Do not touch files in /etc/rc.d/rc5.d or the other locations. They are maintained automatically by chkconfig.

If you look at the headers of files in /etc/rc.d/init.d you will see they all have a common format like this
Code: Select all
#!/bin/sh
#
# Startup script for dansguardian
#
# chkconfig: 345 92 8


This means it will run in run levels 3 (text only with networking), 4 (I forget what run level 4 is), and 5 (graphics with networking) It will start at position 92 (near the end), and shutdown at position 8.

Running the command
Code: Select all
chkconfig startupfilename on
will automatically cause copies of the file to appear in the correct directories
Code: Select all
chkconfig startupfilename off
will remove them again.

See 'man chkconfig'

As it happens you will see there is already a file called /etc/rc.d/rc.5/S99rc-local which is a symlink to /etc/rc-local
This file is there for you to modify to add any applications you want to start at boot time.

If you want an application to start as a user when they log in then put a .desktop file in /etc/xdg/autostart. (independent of which desktop you are using), or else use the method defined for your desktop.
User avatar
djennings
 
Posts: 613
Joined: Jun 2nd, '11, 23:51
Location: Wokingham, UK

Re: Howto automatic run/start a program at startup?

Postby dedanna1029 » Apr 17th, '13, 21:21

Question: What do we do if we only want it to start up automatically for our own user, and use Gnome? Alacarte is not operational right now; it has a bug filed.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
dedanna1029
 
Posts: 99
Joined: Jan 1st, '13, 17:35

Re: Howto automatic run/start a program at startup?

Postby r0b0tl0ve » Apr 18th, '13, 03:16

You could always go old school and put it in your ~/.xsession.

Background each application like this:

Code: Select all
conky >/dev/null 2>&1 &

pidgin >/dev/null 2>&1 &



That way, one app won't hold up another from loading.
r0b0tl0ve
 
Posts: 22
Joined: Apr 12th, '13, 02:00

Re: Howto automatic run/start a program at startup?

Postby dedanna1029 » Apr 18th, '13, 15:40

Thank you. :)

I'm wondering also if putting the .desktop file for the particular program desired to auto-startup in ~/.config/autostart/ would do it? I'm imagining not, as it currently contains .desktop files of proggies I used to have autostart, but are now disabled.

By ~/.xsession, I'm assuming you mean /.gnome-session, ~/.kde-session, etc.? I don't have a ~/.xsession file in the root of my /home.

Thanks again!

Cheers.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
dedanna1029
 
Posts: 99
Joined: Jan 1st, '13, 17:35

Re: Howto automatic run/start a program at startup?

Postby martinw » Apr 18th, '13, 20:15

Assuming you are using Mageia-2, in a terminal window type
Code: Select all
gnome-session-properties

and use the Add button in the Startup Programs tab.
martinw
 
Posts: 608
Joined: May 14th, '11, 10:59

Re: Howto automatic run/start a program at startup?

Postby dedanna1029 » Apr 22nd, '13, 16:32

Ah, thanks. :) Had forgotten that one.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
dedanna1029
 
Posts: 99
Joined: Jan 1st, '13, 17:35


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest