Difference between revisions of "How to launch VNC with aMule at Linux boot"

From AMule Project FAQ
Jump to: navigation, search
Line 1: Line 1:
 
<h2>''By [[User:Frankk|Frankk]]''</h2>
 
<h2>''By [[User:Frankk|Frankk]]''</h2>
 +
 +
== General ==
  
 
This describes a very simple configuration to launch [http://www.redstonesoftware.com/vnc.html VNC] at [http://www.kernel.org Linux] startup (as a specified user). [[aMule]] will be launched automatically with [http://www.redstonesoftware.com/vnc.html VNC].
 
This describes a very simple configuration to launch [http://www.redstonesoftware.com/vnc.html VNC] at [http://www.kernel.org Linux] startup (as a specified user). [[aMule]] will be launched automatically with [http://www.redstonesoftware.com/vnc.html VNC].
Line 48: Line 50:
 
In ''/etc/rc.d/rc.local'' add:
 
In ''/etc/rc.d/rc.local'' add:
  
''<pre>
+
''# Start VNC server''
# Start VNC server
+
''if [ -x /etc/rc.d/rc.vnc ]; then''
if [ -x /etc/rc.d/rc.vnc ]; then
+
''. /etc/rc.d/rc.vnc start''
. /etc/rc.d/rc.vnc start
+
''fi''
fi
+
</pre>''
+
  
 
In ''/etc/rc.d/rc.6'' add:
 
In ''/etc/rc.d/rc.6'' add:
  
''<pre>
+
''# Shut down the VNC server''
# Shut down the VNC server
+
''if [ -x /etc/rc.d/rc.vnc ]; then''
if [ -x /etc/rc.d/rc.vnc ]; then
+
''/etc/rc.d/rc.vnc stop''
/etc/rc.d/rc.vnc stop
+
''fi''
fi
+
</pre>''
+
  
 
In ''~/.vnc/xstartup'' (in home directory of the user specified above) add (change with your preferred [[aMule]] startup script):
 
In ''~/.vnc/xstartup'' (in home directory of the user specified above) add (change with your preferred [[aMule]] startup script):
  
 
+
''amule &''
''<pre>amule &</pre>''
+
 
+
 
+
  
 
== On [http://www.debian.org Debian] Woody ==
 
== On [http://www.debian.org Debian] Woody ==
Line 87: Line 82:
 
Create the ''~/.vnc/xstartup'' file, with the next content<br>
 
Create the ''~/.vnc/xstartup'' file, with the next content<br>
  
<pre>
+
''/usr/bin/flwm &''
/usr/bin/flwm &
+
''/usr/bin/amule &''
/usr/bin/amule &
+
''/usr/bin/amule &''
/usr/bin/amule &
+
</pre>
+
  
 
With sone versions of [http://www.redstonesoftware.com/vnc.html vncserver], it's necessary to launch at least twice the [[aMule]]. The [http://flwm.sourceforge.net flwm] is an optional window manager.
 
With sone versions of [http://www.redstonesoftware.com/vnc.html vncserver], it's necessary to launch at least twice the [[aMule]]. The [http://flwm.sourceforge.net flwm] is an optional window manager.
Line 97: Line 90:
 
Create the file ''~/.vncrc'' with the next content:<br>
 
Create the file ''~/.vncrc'' with the next content:<br>
 
Login as the user and run ''xvncviewer :1'' to create the password file and debug possible probelms (the logs are under the ''~/.vnc/'' dir
 
Login as the user and run ''xvncviewer :1'' to create the password file and debug possible probelms (the logs are under the ''~/.vnc/'' dir
''<pre>
+
 
$vncStartup = "/home/amule/.vnc/xstartup";
+
''$vncStartup = "/home/amule/.vnc/xstartup";''
$geometry ="800x600";
+
''$geometry ="800x600";''
</pre>''
+
 
 
(replace ''/home/amule'' for the home of the user running [http://www.redstonesoftware.com/vnc.html VNC])
 
(replace ''/home/amule'' for the home of the user running [http://www.redstonesoftware.com/vnc.html VNC])
  
 
To show the [[aMule]] window, run:
 
To show the [[aMule]] window, run:
''<pre>
+
''xvncviewer localhost:1''
xvncviewer localhost:1
+
 
</pre>''
+
If you want to autostart a [http://www.redstonesoftware.com/vnc.html VNC] session on system startup, you can put a line in ''/etc/init.d/bootmisc.sh'' like this:
 +
 
 +
''su '''username''' -c vncserver''
  
If you want to autostart a vnc session on system startup, you can put a line in /etc/init.d/bootmisc.sh like this:
+
Replace '''username''' with the name of the user that you want to launch vnc. (Added by '''ghent''')
<pre>
+
su username -c vncserver
+
</pre>
+
Replace username  with the name of the user that you want to launch vnc. (Added by ghent)
+
  
 
== [http://www.mandrake.com Mandrake] 10.0 ==
 
== [http://www.mandrake.com Mandrake] 10.0 ==
  
 
The script from [[User:Frankk|Frankk]] is the one I use, but you can customize the size of the [http://www.redstonesoftware.com/vnc.html VNC] server :
 
The script from [[User:Frankk|Frankk]] is the one I use, but you can customize the size of the [http://www.redstonesoftware.com/vnc.html VNC] server :
''<pre>
+
''/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen"''
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen"
+
 
</pre>''
+
 
add
 
add
''<pre>
+
 
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen -geometry 1240x980"
+
''/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen -geometry 1240x980"''
</pre>''
+
 
 
or whatever value.
 
or whatever value.
  
 
Personaly, I use as xstartup script ([http://www.icewm.org iceWM] is really nice and so CPU-cheap) :
 
Personaly, I use as xstartup script ([http://www.icewm.org iceWM] is really nice and so CPU-cheap) :
<pre>
+
 
#!/bin/sh
+
''#!/bin/sh''
starticewm&
+
''starticewm&''
amule
+
''amule''
</pre>
+
 
  
  
Line 143: Line 133:
  
 
So to run [http://www.redstonesoftware.com/vnc.html VNC] on startup, just do (as root :-) )
 
So to run [http://www.redstonesoftware.com/vnc.html VNC] on startup, just do (as root :-) )
''<pre>ln -s /etc/init.d/amulevnc /etc/rc5.d/S99amule
+
''re>ln -s /etc/init.d/amulevnc /etc/rc5.d/S99amule''
ln -s /etc/init.d/amulevnc /etc/rc6.d/K02amule</pre>''
+
''ln -s /etc/init.d/amulevnc /etc/rc6.d/K02amule''
 
and you're all set!
 
and you're all set!
  

Revision as of 02:22, 18 November 2004

By Frankk

General

This describes a very simple configuration to launch VNC at Linux startup (as a specified user). aMule will be launched automatically with VNC. This will work in Slackware and distro based on the same init method. If someone knows how to modify it to make it work under other distros you are welcome to add it to this page. Thanks.

Add the rc.vnc script to /etc/rc.d

Modify user according to the user running aMule.
The rm /tmp/.X11-unix/X$theScreen is there in case the server crashes or your mother/wife removes the power plug cleaning the room... ;-)

#!/bin/sh
#
# Startup/Stop script for vncserver.
#

#Here, the choosen user to run amule
theUser=choosenuser
#And here, the choosen screen to run the vncserver
theScreen=1

case "$1" in

'start')
if [ -f /tmp/.X11-unix/X$theScreen ]; then rm /tmp/.X11-unix/X$theScreen; fi
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen"
;;

'stop')
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver -kill :$theScreen"
;;

*)
echo "Usage: /etc/init.d/rc.vnc { start | stop }"
;;

esac


Make it executable with:

chmod 755 /etc/rc.d/rc.vnc


Modify the following files:

In /etc/rc.d/rc.local add:

# Start VNC server if [ -x /etc/rc.d/rc.vnc ]; then . /etc/rc.d/rc.vnc start fi

In /etc/rc.d/rc.6 add:

# Shut down the VNC server if [ -x /etc/rc.d/rc.vnc ]; then /etc/rc.d/rc.vnc stop fi

In ~/.vnc/xstartup (in home directory of the user specified above) add (change with your preferred aMule startup script):

amule &

On Debian Woody

Run (as root):

apt-get install vncserver xvncviewer apt-get install vncserver flwm

There is no support for ~/.vnc/xstartup so, instead, use $vncStartup in .vncrc to determine a xstartup-script (this replaces your ~/.xsession file).

For more information, read man vnc.conf

For example, in a Woody/Sarge/Sid:
Login as the user who is going to run aMule
mkdir ~/.vnc/
Create the ~/.vnc/xstartup file, with the next content

/usr/bin/flwm & /usr/bin/amule & /usr/bin/amule &

With sone versions of vncserver, it's necessary to launch at least twice the aMule. The flwm is an optional window manager.

Create the file ~/.vncrc with the next content:
Login as the user and run xvncviewer :1 to create the password file and debug possible probelms (the logs are under the ~/.vnc/ dir

$vncStartup = "/home/amule/.vnc/xstartup"; $geometry ="800x600";

(replace /home/amule for the home of the user running VNC)

To show the aMule window, run: xvncviewer localhost:1

If you want to autostart a VNC session on system startup, you can put a line in /etc/init.d/bootmisc.sh like this:

su username -c vncserver

Replace username with the name of the user that you want to launch vnc. (Added by ghent)

Mandrake 10.0

The script from Frankk is the one I use, but you can customize the size of the VNC server : /bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen"

add

/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin /usr/bin/vncserver :$theScreen -geometry 1240x980"

or whatever value.

Personaly, I use as xstartup script (iceWM is really nice and so CPU-cheap) :

#!/bin/sh starticewm& amule


To start VNC at startup, I called the previous script /etc/init.d/amulevnc and chmod to 744 (chmod 744 /etc/init.d/amulevnc as root).
Instead of modifying /etc/rc.d/rc.vnc, I added links in the corresponding /etc/rc$RUNLEVEL.d directories.
It's quite simple to understand how it works:
Each directory represents a runlevel, and contains links to the scripts from /etc/init.d which need to be run/stop.
For instance, the link /etc/rc5.d/S55sshd to /etc/init.d/sshd will start sshd on runlevel 5, whereas /etc/rc6.d/K25sshd linked to /etc/init.d/sshd will stop it in runlevel 6.
You get it? Links starting with 'KXX' will stop a service, and those starting with 'SXX' will start them. The number will define the order.

So to run VNC on startup, just do (as root :-) ) re>ln -s /etc/init.d/amulevnc /etc/rc5.d/S99amule ln -s /etc/init.d/amulevnc /etc/rc6.d/K02amule and you're all set!

PS: This method should work on systems other than Mandrake, give it a test.

Questions & comments: air_1 at libertysurtf.fr