LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to start an application using the rc.local init script? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-start-an-application-using-the-rc-local-init-script-737944/)

sl33p 07-05-2009 10:10 PM

how to start an application using the rc.local init script?
 
Hi guys,

I'm trying to start an application (qBittorrent) as a regular user, on the background (&) every time I enter runlevel 5 (graphical environment) using the script rc.local:

/etc/rc.d/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
su sleep -c "qbittorrent %f"
#I tried also with:
#/usr/bin/qbittorrent &
#./usr/bin/qbittorrent &
#source /usr/bin/qbittorrent &

partial $ls /etc/rc.d/rc5.d/ output:
Code:

...
lrwxrwxrwx 1 root root 11 2009-04-24 00:42 S99local -> ../rc.local
...

Also, if I run the command:
Code:

$qbittorrent %f
alone in a xterm window, it starts the application correctly.

What am I doing wrong?
Thanks in advance dudes,
sl33p

Tinkster 07-05-2009 10:18 PM

You're trying to run an application before a user owned environment is up.

Either resort to starting the torrent once you're logged in, or use a
command line based client.


Cheers,
Tink

sl33p 07-06-2009 03:56 PM

Quote:

Originally Posted by Tinkster (Post 3597949)
You're trying to run an application before a user owned environment is up.

Either resort to starting the torrent once you're logged in, or use a
command line based client.


Cheers,
Tink

Thanks for the help.

You mean by "resort to starting the torrent once you're logged in", by running it in a login script, like /etc/.bashrc ??


sl33p

Tinkster 07-06-2009 04:47 PM

From an autorun feature, e.g. KDE's autostart directory. That will depend on your
DE/WM ...


Cheers,
Tink

sl33p 07-07-2009 04:06 PM

Quote:

Originally Posted by Tinkster (Post 3598958)
From an autorun feature, e.g. KDE's autostart directory. That will depend on your
DE/WM ...


Cheers,
Tink

Thanks man, understood.

According to GNOME's documentation, this directory is ~/.config/autostart (user-specific) and /etc/xdg/autostart (system-wide).

Now I'm at work, so when I get home, I'll try it out on my (way better) linux box. ;)

Regards,
sl33p


All times are GMT -5. The time now is 02:53 AM.