Solaris ok prompt

# OK prompt
How to get to the OK Prompt You can shutdown the system using init 0
Reboot the system and press the STOP + A keys together as the boot time messages appear on the screen
Sets diagnostic mode ( diag-switch? True ) Pressing STOP and D Keys
Sets configuration variables to default value Pressing STOP and N Keys

# Commands
OK showdevs
OK show-disks
OK boot /dev/dsk/c0t0d0s0 -s
OK boot cdrom -s

# Boot Single User Mode:
OK> boot -s

Solaris create ALOM network

sc> shownetwork
SC network configuration is:
IP Address: 0.0.0.0
Gateway address: 0.0.0.0
Netmask: 255.255.255.0
Ethernet address: 00:03:ba:57:76:8e
sc> setupsc
Entering Interactive setup mode. To exit and discard changes to that point, use Ctrl-C or to exit and save changes to that point, use Ctrl-Z.
Do you wish to configure the enabled interfaces [y]? y
Should the SC network interface be enabled [y]? y
Should the SC email alerts be enabled [y]? n
Do you wish to configure the network interface [y]? y
Should the SC use DHCP to obtain its network configuration [n]? n
Enter the SC IP address [100.100.100.100]? 192.168.0.225
Enter the SC IP netmask [255.255.255.0]? 255.255.255.240
Enter the SC IP gateway address [100.100.100.100]? 192.168.0.228
Should the TPE link test be enabled [y]? y
Do you wish to configure the managed system interface [y]? n
Do you wish to configure the network management interfaces [y]? n
Do you wish to configure the SC parameters [y]? n
Your ALOM configuration profile has been successfully completed. To activate your network configuration, please reset the SC.
sc> resetsc
Are you sure you want to reset the SC [y/n]? y
User Requested SC Shutdown

SC Alert: SC System booted.

SC Alert: AC power unavailable for PSU @ PS0.

[SC Status 7fff – OK] Enter #. to return to ALOM.
Oct 18 14:16:57 nlnwhabcm03 rmclomv: SC unretrieved msg OCT 18 13:16:54 2004 UTC [SC System booted.]

Copyright 2003 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

Sun(tm) Advanced Lights Out Manager 1.3 (nlnwhabcm03)

Please login: admin
Please Enter password: ******

sc> shownetwork
SC network configuration is:
IP Address: 192.168.0.225
Gateway address: 192.168.0.228
Netmask: 255.255.255.240
Ethernet address: 00:03:ba:57:76:8e
sc>

# Open console by ALOM port

$ telnet db01-alom
– login: admin
– password: admin

$ console -f
– login: root
– password: <>

Now your are login!

Solaris cluster commands

hastatus (Show cluster status)
hares -offline -sys (Stop component)
hares -online -sys (Start component)

hagrp -clear (Clear groep die gecrashed is)

hastatus -sum # Show autodisable groups
hagrp -autoenable

vxprint – Show status Veritas

# Check Veritas Cluster main.cf file
hacf -verify /etc/VRTSvcs/conf/config -display

# Configuration Read /Write
haconf -makerw
hares -modify DB_OP_XX_SID Critical 0
hares -value DB_OP_XX_SID Critical
hares -modify DB_OP_XX_SID Enabled 0
hares -value DB_OP_XX_SID Enabled
haconf -dump -makero

SUN StorEdge Backup Solution scripts

# General
/usr/sbin/nsr/nsrim -v (Print Volume information of all used tapes)

# ——————————————————————————
# BACKUP (SINGLE TAPE DEVICE)
# ——————————————————————————

0 19 * * 1-5 /usr/sbin/nsr/tape_label_mount.sh >> /nsr/logs/tape.log
#!/bin/sh
#
# Load / relabel / mount tape
#
/usr/sbin/nsr/nsrmm -l -R << EOF y EOF sleep 30 /usr/sbin/nsr/nsrmm -m 20:30 start total backup StorEdge backup software regeld dit! 0 6 * * 1-5 /usr/sbin/nsr/tape_unmount.sh >> /nsr/logs/tape.log
#!/bin/sh
#
# unLoad /eject tape
#
/usr/sbin/nsr/nsrmm -j

# ——————————————————————————
# BACKUP (TAPE ROBOT 8 POSITIES)
# ——————————————————————————

00:30 start load/relabel/mount script

#!/bin/sh
#
# Load / label / mount tape
#
# Volume Name Tape Location Note
# volume.001 Location 1 Monday
# volume.002 Location 2 Tuesday
# volume.003 Location 3 Wedneyday
# volume.004 Location 4 Thursday
# volume.005 Location 5 Friday
# volume.006 Location 6 Saterday
# volume.007 Location 7 Sunday
# Location 8 Clean tape location

DAYOFWEEK=`date +”%u`

# Load / relabel tape (-Y No approve of action is needed)
/usr/sbin/nsr/nsrjb -Y -L -S ${DAYOFWEEK} svolume.00${DAYOFWEEK}

# Mount tape
/usr/sbin/nsr/nsrjb -l -S ${DAYOFWEEK}

01:00 start total backup
StorEdge backup software regeld dit!

23:30 start unmount / unmount script

#!/bin/sh
#
# unLoad tape
#

DAYOFWEEK=`date +”%u`

# unmount / unload tape
/usr/sbin/nsr/nsrjb -u -S ${DAYOFWEEK}

Veritas Commands

Veritas

Producten:
– Veritas File System Manager
– Veritas Volume manager
– Veritas Cluster

Commandos:
vxdg list : Show Disk Silyses

Veritas Volume Manager:
– Start GUI
# export DISPLAY=172.16.1.177:0.0
# vea &
Login=root Password=Default
– Stop
# vxdctl stop
# vxiod -f set 0

Veritas Volume Cluster:
– Start GUI
# export DISPLAY=172.16.1.177:0.0
# hagui &
Login=admin Password=Password

Change Parity:
# format
% select disk
% parity
% 7 (select parity 7)
% size = 0c
% label

Update License:
# mkdir /etc/vx/licenses/lic/old
# mv /etc/vx/licenses/lic/* /etc/vx/licenses/lic/old ; /opt/VRTSvlic/bin/vxlicinst
bv. 3ZPV-NCCT-H7MH-VL6T-Z36X-RRC

# Check cluser config
hacf -verify /etc/VRTSvcs/conf/config

MySQL commands

########
LOAD DUMP

After you have dumped out your data into a file as described here, FTP or scp that dump file to the home directory (/) on our system.

Once you have uploaded the dump file to your account here, get a shell prompt on our system using telnet or ssh.

Now import the dump file into MySQL by typing all the following on 1 single line at the shell prompt:

mysql -p -h DBSERVER dbname < dbname.sql The above assumes that your database name on our system is "dbname" and the dumpfile that you uploaded was named "dbname.sql". Replace those with your correct database name and dumpfile filename. Also replace DBSERVER with your correct database server name. ####### Creating MySQL database on Linux system 1. I assume that you are working from your account and not the root. Start a terminal session and become the superuser (Type su at the prompt and then enter the root password). 2. Now we'll access the MySQL server. Type: mysql -u root -p The system prompts for the MySQL root password that you set up in Installing MySQL on Linux. (Note: This is not the Linux root password but the MySQL root password). Enter the password, which is not displayed for security reasons. Once you are successfully logged in, the system prints a welcome message and displays the mysql prompt ... something like Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 3.22.32 Type 'help' for help. mysql>

3. Now we are ready for creating the employees database. Issue the command:

create database employees;

(Note: The command ends with a semi-colon)

4. An important point to note is that this database is created by the root and so will not be accessible to any other user unless permitted by the root. Thus, in order to use this database from my account (called manish), I have to set the permissions by issuing the following command:

GRANT ALL ON employees.* TO manish@localhost IDENTIFIED BY “eagle”

The above command grants my account (manish@localhost) all the permissions on employees database and sets my password to eagle. You should replace manish with your user name and choose an appropriate password.
5. Close the mysql session by typing quit at the prompt. Exit from superuser and come back to your account. (Type exit).
6. To connect to MySQL from your account, type:

mysql -u user_name -p

Type in the password when prompted. (This password was set by the GRANTS ALL… command above) . The system displays the welcome message once you have successfully logged on to MySQL. Here is how your session should look like:

[manish@localhost manish]$ mysql -u manish -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.22.32

Type ‘help’ for help.

mysql>

7. Typing the command SHOW DATABASES; will list all the databases available on the system. You should get a display similar to:

mysql> SHOW DATABASES;
+—————-+
| Database |
+—————-+
| employees |
| mysql |
| test |
+—————-+
3 rows in set (0.00 sec)

8. Enter quit at the mysql> prompt to come out of the mysql client program.

######
SET OLD PASSWORD

Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:

mysql> SET PASSWORD FOR ‘some_user’@’some_host’ = OLD_PASSWORD(‘newpwd’);
mysql> FLUSH PRIVILEGES;

Substitute the password you want to use for “newpwd” in the preceding examples. MySQL cannot tell you what the original password was, so you’ll need to pick a new one.

######
Drop database

Definition: The drop database command is used when you no longer need one of the SQL databases on your server. It will remove it permanently. It is phrased as: drop database [DatabaseName];
Examples: This will remove the database ‘Dresses’ from the MySQL server:

mysql> drop database Dresses;

Ubuntu 10.x with Java7

How to install Java on Ubuntu 10.x

Download he 32bit or 64bit Linux “compressed binary file” – it has a “.tar.gz” file extension i.e. “[java-version]-i586.tar.gz” for 32bit and “[java-version]-x64.tar.gz” for 64bit

Uncompress it
# tar -xvf jdk-7u2-linux-i586.tar.gz (32bit)
# tar -xvf jdk-7u2-linux-x64.tar.gz (64bit)

JDK 7 package is extracted into ./jdk1.7.0_02 directory. N.B. check carefully this folder name since Oracle seem to change this occasionally with each update.

Now move the JDK 7 directory to /usr/lib

# sudo mkdir -p /usr/lib/jvm
# sudo mv ./jdk1.7.0_02 /usr/lib/jvm/jdk1.7.0

Now run

# sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/jdk1.7.0/bin/java” 1
# sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.7.0/bin/javac” 1
# sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/jvm/jdk1.7.0/bin/javaws” 1

This will assign Oracle JDK a priority of 1, which means that installing other JDKs will replace it as the default. Be sure to use a higher priority if you want Oracle JDK to remain the default. Correct the file ownership and the permissions of the executables:

# sudo chmod a+x /usr/bin/java
# sudo chmod a+x /usr/bin/javac
# sudo chmod a+x /usr/bin/javaws
# sudo chown -R root:root /usr/lib/jvm/jdk1.7.0

Check the version of you new JDK 7 installation:

# java -version

java version “1.7.0”
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)

VirtualBox Windows / Solaris 10 / Xming

I had the following problem with Solaris 10 X86 in a VirtualBox container. I could not make a XDMCP session with xming to this Solaris 10 container.

After long searching I found that default Windows 7 Enterprise is blocking (firewall) this connection. To resolve this issues go to the Control Panel – Windows firewall – Advanched settings -> Inbound Rules. Find Xming X server and enable each profile.

Then everything is working fine.

On the Solaris 10 site the following steps must be executed to enable XDMCP

Solaris 10’s desktop environment is JDS which is based off of GNOME.

– Log in as root
– Open a terminal
– Type gdmsetup (a dialog box will appear)
– Click on the XDMCP tab
– Check the Enable XDMCP box
– Press Close

VPS 512MB config

Yesterday i upgraded my VPS from 256MB to 512MB memory (1GB Burst) to have some more resources to handle traffic.

On this VPS the following software is installed:
– Ubuntu 10
– Apache 2.2.16
– MySQL 5.1.61
– PHP 5.5.3

I am running five website with regular traffice (+/- 15.000 requests a day) on the VPS:
– PlaatScrum (Self made PHP site)
– PlaatSoft (WordPress site)
– Family van der Plaat (WordPress site)
– Education (Self made PHP site)
– Service (Self made PHP site)

I found out the below configuration results in the best performance:

Apache2

The following modules are activated:
– alias
– dir
– mime
– negotiation
– php5
– rewrite
– status

The following apache2.conf is active:

MaxKeepAliveRequests 0
KeepAliveRequests 15

[mpm_prefork_module]
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 30
MaxRequestsPerChild 0

[mpm_worker_module]
StartServers 1
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 30
MaxRequestsPerChild 0

[mpm_event_module]
StartServers 1
MaxClients 30
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0

MySQL

[mysqld]
skip-innodb

key_buffer = 8M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 4

myisam-recover = BACKUP
max_connections = 50
table_cache = 128

query_cache_limit = 512K
query_cache_size = 8M

VPS 256MB config

I am using for two weeks a VPS with 256MB memory. On this VPS the following software is installed:
– Ubuntu 10
– Apache 2.2.16
– MySQL 5.1.61
– PHP 5.5.3

I am running five website with regular traffice (+/- 15.000 requests a day) on the VPS:
– PlaatScrum (Self made PHP site)
– PlaatSoft (WordPress site)
– Family van der Plaat (WordPress site)
– Education (Self made PHP site)
– Service (Self made PHP site)

I found out the below configuration results in the best performance:

Apache2

[mpm_prefork_module]
StartServers 1
MinSpareServers 2
MaxSpareServers 2
MaxClients 15
MaxRequestsPerChild 0

[mpm_worker_module]
StartServers 1
MinSpareThreads 2
MaxSpareThreads 2
ThreadLimit 64
ThreadsPerChild 25
MaxClients 15
MaxRequestsPerChild 0

[mpm_event_module]
StartServers 1
MaxClients 15
MinSpareThreads 2
MaxSpareThreads 2
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0

MySQL

[mysqld]
skip-innodb

key_buffer = 8M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 4

myisam-recover = BACKUP
max_connections = 50
table_cache = 128

query_cache_limit = 512K
query_cache_size = 8M

WAMP + PostgreSQL integration

If you want to extend an existing Windows WAMP installation with a PostgreSQL database execute the following steps:

Apache 2.2.X configuration
Add the next line to the Apache 2.2.x httpd.conf configuration:
LoadFile “C:/Program Files/PostgreSQL/9.1/bin/libpq.dll”

Above line must be entered before the next line.
LoadModule php5_module “c:/wamp/bin/php/php5.2.11/php5apache2_2.dll”

PHP 5.2.X Configuration
Enable (remove trailing ; character) the following two lines in the php.ini configuration file.
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

Restart WAMP
Restart the wamp (apache, php and mysql) software.

Test
Create the following test.php file and place it in the apache www root directory:

<?php
echo extension_loaded('pgsql') ? 'yes':'no';
?>

When the php file is executed (http://127.0.0.1/test.php) in apache the following information must be showed on screen.

yes

PHP stock information example

Hereby an easy example how you can use the finance.yahoo.com webservice to fetch stock exchange information with PHP.


	function warquest_stockarray($data,$delim=',',$enclosure='"') {
		$enclosed=false;
		$fldcount=0;
		$linecount=0;
		$fldval='';
		for($i=0;$i<strlen($data);$i++) {
			$chr=$data{$i};
			switch($chr)
			{
				case $enclosure:
					if($enclosed&&$data{$i+1}==$enclosure) {
						$fldval.=$chr;
						++$i; 
					} else {
						$enclosed=!$enclosed;
					}
					break;
   
				case $delim:
					if(!$enclosed) {
						$ret_array[$linecount][$fldcount++]=$fldval;
						$fldval='';
					} else {
						$fldval.=$chr;
					}
					break;
				
				case "\r":
					if (!$enclosed&&$data{$i+1}=="\n") continue;
					
				case "\n":
					if(!$enclosed) {
						$ret_array[$linecount++][$fldcount]=$fldval;
						$fldcount=0;
						$fldval='';
					} else {
						$fldval.=$chr;
					}
					break;
				
				default:
					$fldval.=$chr;
			}
		}
		if($fldval) {
			$ret_array[$linecount][$fldcount]=$fldval;
		}
		return $ret_array;
	}

	function warquest_stock($stocksymbols) {		
		$url = sprintf("http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=snl1d1t1c1ohgvp", $stocksymbols);
		$data = file_get_contents($url);
	
		$stocklist=warquest_stockarray($data);
	
		for($i=0;$i<count($stocklist);$i++) {
		
			$stocksymbol=trim($stocklist[$i][0], '\"');
			$stock[$stocksymbol]["stocksymbol"] = 
			$stock[$stocksymbol]["company"] = trim($stocklist[$i][1], '\"');
			$stock[$stocksymbol]["last"] = $stocklist[$i][2];
			$stock[$stocksymbol]["date"] = trim($stocklist[$i][3], '\"');	
			$stock[$stocksymbol]["time"] = trim($stocklist[$i][4], '\"');					
			$stock[$stocksymbol]["change"] = $stocklist[$i][5];
			$stock[$stocksymbol]["open"] = $stocklist[$i][6];
			$stock[$stocksymbol]["high"] = $stocklist[$i][7];
			$stock[$stocksymbol]["low"] = $stocklist[$i][8];
			$stock[$stocksymbol]["volume"] = $stocklist[$i][9];
			$stock[$stocksymbol]["prevclose"] = $stocklist[$i][10];	
		}
		return $stock;
	}
	
	print_r(warquest_stock("DB"));


GRRLIB 4.3.0 slow with FreeType

On this moment GRRLIB 4.3.0 is working slow in combination with FreeType font access. Check out below mail content. The good news is that “Crayon” is working on a solution. I will keep you informed!

Hi Crayon, Today i have upgrade the GRRLIB from 4.2.1 to 4.3.0 in TowerDefense. The upgrade went good but the result was not really good. For some reason the freetype library is very slow. Resulting in poor (Frame-Per-Seconds) during the game play. Early this year you have tuned this library in the GRRlib 4.2.1 build and it was lighting fast. Why is it now so slow again. Do you have a idea? Looking forward to your response. wplaat

Hi wplaat, the code in GRRLIB has not changed that much, maybe the problem could be related to FreeType. If you have time, could you try to test older version of FreeType. Try different combination FreeType / GRRLIB. Let me know if you find something, I’ll try to test stuff on my side. Thanks for the feed back, Crayon

Hi crayon, Good news. I found the performance problem. I was testing wrong. I did not known, that when I compiled the new GRRLIB 4.3.0 library the *.a and *.h files were copied to the devkitpro directory. Therefor I was using everytime with the same “new” libraries. If I now replace the new freetype library of GRRLIB 4.3.0 build with my own old Freetype library (Downloaded from the wiibrew.org site). Everything is working lighting fast again. So the problem is related to the new freetype library. Can the performance issue be related to some wrong build flags in the freetype makefile? wplaat

hi wplaat, Good news, I was actually looking at your code 🙂 I’m going to test different way of building FreeType. It might be related to TrueType hinting, a new feature in FreeType 2.4.0. I’m going to try to build Freetype without this feature, normally TrueType hinting is suppose to make your text look better, but it might be slower too. I’ll keep you inform if I find something. Crayon

Drupal 5.x to 6.x migration

Last night I migrated the oostpoort website from Drupal 5.x to Drupal 6.x. The following steps did i executed to successful migrate the website.

1. Downloaded for each used 5.x module the 6.x release.
2. Make first backup.
3. Upgrade Drupal 5.20 to latest available level 5.22.
4. Upgrade all used Drupal 5.x modules to latest available level.
5. Make second backup.
6. Disable all none core related modules
7. Uninstall update_status 5.x module
8. Remove all Drupal 5.x modules from file system
9. Remove Drupal 5.x core files from file system.
10. Install Drupal 6.x core on file system
11. Configure settings.php (Take the new 6.x template as base) with correct database settings. Set $update_free_access to TRUE.
12. Access the website.
13. Run update.php two times
14. Now the system runs without any issues on Drupal 6.x
15. Install all needed Drupal 6.x modules.
16. Enable all modules and run again update.php
17. Change $update_free_access to FALSE in settings.php
18. Optional: Update theme template
19. Optional: Make third backup.

Some remarks:
– All these steps took four hours in total.
– If in the drupal configuration the start URL is “frontpage” replace it which “node” else the frontpage is not working anymore.
– If any of these steps fail restore the website which the available backup.