Page 1 of 1

Startup Script for Ubuntu 8.10

Posted: 28. Mar 2009, 20:39
by christr
I've written the following script to start my Virtual Boxes in the background on my Ubuntu machine. One VM is Solaris 10, and the other is WinXP. Can anyone give me some ideas on what I might be doing wrong? I've pasted the info from my machine below. The problem is that these machines will not boot at startup. But, if I su to root after the machine has booted and kick off the script manually they startup just fine. It's probably something simple, but I must be too close to the problem.

Code: Select all

root@tabasco:~# ls -la /etc/rc3.d | grep S99vbox
lrwxrwxrwx   1 root root    16 2009-03-22 13:51 S99vbox -> /etc/init.d/vbox
root@tabasco:~# cat /etc/init.d/vbox
#!/bin/sh

# Startup Virtual Machines.

case $1 in
'start' )
su chris -c '/usr/bin/VBoxHeadless -v off -s tabasco01 &'
su chris -c '/usr/bin/VBoxHeadless -v off -s tabasco02 &' 

   ;;
'stop' )
su chris -c '/usr/bin/VBoxManage controlvm tabasco01 poweroff'
su chris -c '/usr/bin/VBoxManage controlvm tabasco02 poweroff'
   ;;
*)
   echo "usage: `basename $0` {start|stop}"
esac
root@tabasco:~#

Re: Startup Script for Ubuntu 8.10

Posted: 28. Mar 2009, 21:37
by Sasquatch
I created a code block for you, do that yourself next time.

Now the issue here, is that you have it only on one run-level. The point of start and stop scripts, is that you create an init.d script, then run update-rc.d. See http://www.debian-administration.org/articles/28 and http://www.annodex.net/cgi-bin/man/man2 ... ate-rc.d+8 for more information. Sxx scripts in the run-levels are for Shutdown. Kxx scripts are for boot.

Re: Startup Script for Ubuntu 8.10

Posted: 28. Mar 2009, 23:17
by christr
Thank you very much! That fixed it. I'm used to manually creating soft links for my scripts in other Unix OS's, such as Solaris. That solved my problem. The VMs are now starting at bootup as expected. I've included what I did below.

Code: Select all

chris@tabasco:~$ sudo update-rc.d vbox start 99 2 3 4 5 . stop 99 0 1 6 .
[sudo] password for chris: 
 Adding system startup for /etc/init.d/vbox ...
   /etc/rc0.d/K99vbox -> ../init.d/vbox
   /etc/rc1.d/K99vbox -> ../init.d/vbox
   /etc/rc6.d/K99vbox -> ../init.d/vbox
   /etc/rc2.d/S99vbox -> ../init.d/vbox
   /etc/rc3.d/S99vbox -> ../init.d/vbox
   /etc/rc4.d/S99vbox -> ../init.d/vbox
   /etc/rc5.d/S99vbox -> ../init.d/vbox
chris@tabasco:~$ 
Also, just FYI --
Sxx scripts in the run-levels are for Shutdown. Kxx scripts are for boot.
--- it's actually the other way around (Sxx = startup, and Kxx = shutdown/kill).

Re: Startup Script for Ubuntu 8.10

Posted: 28. Mar 2009, 23:38
by Sasquatch
christr wrote:Also, just FYI --
Sxx scripts in the run-levels are for Shutdown. Kxx scripts are for boot.
--- it's actually the other way around (Sxx = startup, and Kxx = shutdown/kill).
Ah, my bad.

Glad it works. Do some homework, and you certainly don't want to do everything yourself, you will waste a lot of time with that. Why run Debian with pre-build packages when you can run Gentoo and compile everything from source ;).