Difference between revisions of "Running CTP as a Linux Service"

From MircWiki
Jump to navigation Jump to search
(Created page with "This is most easily done using [http://www.ubuntu.com/ Ubuntu] or any other Linux distro that has [http://upstart.ubuntu.com/ upstart] == Instructions for installing the latest...")
 
Line 4: Line 4:
 
== Instructions for installing the latest CTP/MIRC-Zn in Ubuntu ==
 
== Instructions for installing the latest CTP/MIRC-Zn in Ubuntu ==
 
   
 
   
 +
#!/bin/bash
 +
 +
#check which chipset we're using
 +
case $(arch) in
 +
        i686)
 +
                CHIP=i586
 +
        ;;
 +
        x86_64)
 +
                CHIP=amd64
 +
        ;;
 +
        *)
 +
        ;;
 +
esac
 +
 +
 
  # partner repo
 
  # partner repo
 
  echo deb http://archive.canonical.com/ lucid partner >>/etc/apt/sources.list.d/partner.list
 
  echo deb http://archive.canonical.com/ lucid partner >>/etc/apt/sources.list.d/partner.list
Line 19: Line 34:
 
   
 
   
 
  # get jai binary
 
  # get jai binary
  wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-i586-jdk.bin  
+
  wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-$CHIP-jdk.bin  
 
   
 
   
 
  # make it executable
 
  # make it executable
  chmod 777 ./jai_imageio-1_1-lib-linux-i586-jdk.bin
+
  chmod 777 ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin
 
   
 
   
 
  # fix an inherent flaw in the file (thanks to JGrass for this)
 
  # fix an inherent flaw in the file (thanks to JGrass for this)
  sed -i 's/+215/-n+215/' ./jai_imageio-1_1-lib-linux-i586-jdk.bin
+
  sed -i 's/+215/-n+215/' ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin
 
   
 
   
 
  # put it in the jdk folder
 
  # put it in the jdk folder
  mv ./jai_imageio-1_1-lib-linux-i586-jdk.bin /usr/lib/jvm/java-6-sun/
+
  mv ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin /usr/lib/jvm/java-6-sun/
 
   
 
   
 
  # execute the installer
 
  # execute the installer
 
  cd /usr/lib/jvm/java-6-sun/
 
  cd /usr/lib/jvm/java-6-sun/
  ./jai_imageio-1_1-lib-linux-i586-jdk.bin
+
  ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin
 
   
 
   
 
  # go back to the home folder
 
  # go back to the home folder
Line 42: Line 57:
 
  # have to re-login with X forwarding
 
  # have to re-login with X forwarding
 
  echo 'type exit to logout and then log back in with ssh -Y root@host (from a mac) '
 
  echo 'type exit to logout and then log back in with ssh -Y root@host (from a mac) '
 +
 +
# make an upstart script
 +
cat > /etc/init/MIRC-Zn.conf <<DELIM
 +
description "MIRC Zn (CTP plugin not Tomcat)"
 +
author "Tim Phillips <timothy.john.phillips@gmail.com>"
 +
 +
start on (local-filesystems and net-device-up IFACE!=lo)
 +
stop on stopping network-services
 +
 +
respawn
 +
 +
expect fork
 +
 +
script
 +
cd /usr/share/CTP/
 +
java -jar ./CTP-runner.jar
 +
end script
 +
DELIM

Revision as of 11:37, 9 September 2011

This is most easily done using Ubuntu or any other Linux distro that has upstart


Instructions for installing the latest CTP/MIRC-Zn in Ubuntu

#!/bin/bash

#check which chipset we're using
case $(arch) in
        i686)
                CHIP=i586
        ;;
        x86_64)
                CHIP=amd64
        ;;
        *)
        ;;
esac

# partner repo
echo deb http://archive.canonical.com/ lucid partner >>/etc/apt/sources.list.d/partner.list
apt-get update

# preset the java answers:
debconf-set-selections << END
sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
END

# packages installed:
apt-get install -y acpid htop unzip xauth libxtst6 sun-java6-jdk  

# get jai binary
wget http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-$CHIP-jdk.bin 

# make it executable
chmod 777 ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin

# fix an inherent flaw in the file (thanks to JGrass for this)
sed -i 's/+215/-n+215/' ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin

# put it in the jdk folder
mv ./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin /usr/lib/jvm/java-6-sun/

# execute the installer
cd /usr/lib/jvm/java-6-sun/
./jai_imageio-1_1-lib-linux-$CHIP-jdk.bin

# go back to the home folder
cd -

# get MIRC installer
wget http://mirc.rsna.org/MIRC2/MIRC-installer.jar 

# have to re-login with X forwarding
echo 'type exit to logout and then log back in with ssh -Y root@host (from a mac) '

# make an upstart script
cat > /etc/init/MIRC-Zn.conf <<DELIM
description "MIRC Zn (CTP plugin not Tomcat)"
author "Tim Phillips <timothy.john.phillips@gmail.com>"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on stopping network-services

respawn

expect fork

script
	cd /usr/share/CTP/
	java -jar ./CTP-runner.jar
end script
DELIM