Invincible Youth Ep. 23

invincible-youth-e23-20100413-kbsw-avi_thumbs_2010-04-14_00-52-17
Invincible Youth, Episode 23, April 14 2010, from KBS World

Continue reading Invincible Youth Ep. 23

VirtualBox as service

Originally from this post: http://www.kernelhardware.org/virtualbox-auto-start-vm-centos-fedora-redhat/

However, in case you’re unable to view the page (404 error), here’s the steps:

Get list of virtual machines (VM) available: (run as user who owns the VMs)

VBoxManage list vms
"XP" {ea077a37-fe9c-40bd-a508-a4ea0be17e17}
"fedora13" {0cf0d60f-e482-407b-8c4f-b661692f6435}
"centos5" {4a10fb5f-37ba-4012-a41a-e94c6035fc15}

Create config file: (fill with only VM that you want to start on boot or when you run ‘service vboxcontrol start’)

vim /etc/virtualbox/machines_enabled
XP
fedora13
centos5

Create startup script:

vim /etc/init.d/vboxcontrol
#!/bin/sh
# vboxcontrol   Startup script for VirtualBox Virtual Machines
#
# chkconfig: 345 98 02
# description: Manages VirtualBox VMs
# processname: vboxcontrol
#
# pidfile: /var/run/vboxcontrol/vboxcontrol.pid
#
### BEGIN INIT INFO
#
### END INIT INFO
#
# Version 20100414 by azwan082
# Version 20090301 by Kevin Swanson <kswan.info> based on:
# Version 2008051100 by Jochem Kossen <[email protected]>
# http://farfewertoes.com
#
# Released in the public domain
#
# This file came with a README file containing the instructions on how
# to use this script
#
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 1
fi

########################################################################
# INITIAL CONFIGURATION
VBOXDIR="/etc/virtualbox"
VM_USER="username"
USE_NAT="no"

export PATH="${PATH:+$PATH:}/bin:/usr/bin:/usr/sbin:/sbin"
if [ -f $VBOXDIR/config ]; then
. $VBOXDIR/config
fi

SU="su $VM_USER -c"
VBOXMANAGE="VBoxManage -nologo"

########################################################################
# FUNCTIONS

# Determine if USE_NAT is set to "yes"
use_nat() {
if [ "$USE_NAT" = "yes" ]; then
return `true`
else
return `false`
fi
}

log_failure_msg() {
echo $1
}

log_action_msg() {
echo $1
}

# Check for running machines every few seconds; return when all machines
# are down
wait_for_closing_machines() {
RUNNING_MACHINES=`$SU "$VBOXMANAGE list runningvms" | wc -l`
if [ $RUNNING_MACHINES != 0 ]; then
sleep 5
wait_for_closing_machines
fi
}

########################################################################
# RUN
case "$1" in
start)
if [ -f /etc/virtualbox/machines_enabled ]; then
cat /etc/virtualbox/machines_enabled | while read VM; do
log_action_msg "Starting VM: $VM ..."
$SU "$VBOXMANAGE startvm "$VM" -type headless"
RETVAL=$?
done
touch /var/lock/subsys/vboxcontrol
fi
;;
stop)
# NOTE: this stops all running VM's. Not just the ones listed
# in the config
$SU "$VBOXMANAGE list runningvms" | egrep -o "^"[a-zA-Z0-9]*"" | while read VM; do
log_action_msg "Shutting down VM: $VM ..."
$SU "$VBOXMANAGE controlvm "$VM" acpipowerbutton"
done
rm -f /var/lock/subsys/vboxcontrol
wait_for_closing_machines
;;
start-vm)
log_action_msg "Starting VM: $2 ..."
$SU "$VBOXMANAGE startvm "$2" -type headless"
;;
stop-vm)
log_action_msg "Stopping VM: $2 ..."
$SU "$VBOXMANAGE controlvm "$2" acpipowerbutton"
;;
poweroff-vm)
log_action_msg "Powering off VM: $2 ..."
$SU "$VBOXMANAGE controlvm "$2" poweroff"
;;
status)
echo "The following virtual machines are currently running:"
$SU "$VBOXMANAGE list runningvms" | egrep -o "^"[a-zA-Z0-9]*"" | while read VM; do
echo -n "$VM ("
echo -n `$SU "VBoxManage showvminfo ${VM%% *}|grep Name:|sed -e 's/^Name:s*//g'"`
echo ')'
done
;;
*)
echo "Usage: $0 {start|stop|status|start-vm <VM name>|stop-vm <VM name>|poweroff-vm <VM name>}"
exit 3
esac
exit 0

Set script as executable

chmod 755 /etc/init.d/vboxcontrol

Add to service registry:

chkconfig --add vboxcontrol

Set it to start on boot:

chkconfig vboxcontrol on

Subversion on thumbdrive

This post shows how to create a Subversion (SVN) repo on a thumbdrive. I don’t know what’s the minimum capacity of thumbdrive should be used, but 2GB seems enough (mine’s 8GB)

Software to use: RabbitVCS

There are 3 parts, download all parts (Core, Nautilus & GEdit plugin), and install them

  • Select all 3 packages, right click > Open with Package Installer
    screenshot-1a

Assumptions:

  • the repo folder on thumbdrive is referred as /media/thumbdrive/project_repo
  • project folder is ~/project/my_project (folder contains your work)

Create new repository:

  1. Create a folder (for repo) on thumbdrive (/media/thumbdrive/project_repo)
  2. Go inside that folder, right click > RabbitVCS > Create repository here
    screenshot-1
  3. Create temporary folder (~/tmp) and create repo layout inside:
    • ~/tmp/trunk
    • ~/tmp/branches
    • ~/tmp/tags
  4. Import repo layout into repo inside the thumbdrive:
    • Select ~/tmp > right click > RabbitVCS > Import
    • Repository: file:///media/thumbdrive/project_repo
    • enter import message, and OK
      screenshot-21
  5. Import project folder into repo inside the thumbdrive:
    • Select ~/project/my_project, right click > RabbitVCS > Import
    • Repository: file:///media/thumbdrive/project_repo/trunk
    • enter message, and OK

Check out repo into another computer

Assuming this another computer running Windows, it should have TortoiseSVN installed.
Note: c:usersusername is referred as ~ in this post, repo folder in thumbdrive is e:project_repo

  1. Go to project folder (folder which your keep all your project files, e.g. ~projects)
  2. Right click > SVN Checkout
    svn-checkout-1
  3. URL of repository: file:///E:/project_repo/trunk
  4. Checkout directory – make sure it is ~projects, then OK
    svn-checkout