CahBojonegoro

Rawe Rawe Rantas, Malang Malang Putung

Archive for the ‘Unix’ Category

Start XAMPP at boot – Ubuntu way

with 6 comments

I Installed XAMPP inside Ubuntu JeOS in Virtual Box. Using this XAMPP, i create a blog to manage all note & tips my work that can’t be posted in public because of proprietary reason.
This lightweight JeOS is only having Operating System without any Graphical User Interface and i need to start XAMPP service automatically at start up of the VM. So, here i go.

( I installed XAMPP in /opt . Full path of lampp binary is /opt/lampp/lampp )

1. Create an init script in /etc/init.d/

cd /etc/init.d/
sudo vi lampp
copy and paste this lines:
#!/bin/bash
/opt/lampp/lampp start

2. Use update-rc.d to install init scripts to all runlevel.

sudo update-rc.d lampp defaults

In the next restart, XAMPP will automatically started. We can verify using this command.

user@jeos$ ps -ef | grep lampp
root      3842     1  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
root      3869     1  0 20:42 ?        00:00:00 /bin/sh /opt/lampp/bin/mysqld_safe –datadir=/opt/lampp/var/mysql –pid-file=/opt/lampp/var/mysql/jeos.pid
nobody    3903  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody    3923  3869  0 20:42 ?        00:00:01 /opt/lampp/sbin/mysqld –basedir=/opt/lampp –datadir=/opt/lampp/var/mysql –user=nobody –pid-file=/opt/lampp/var/mysql/jeos.pid –skip-external-locking –port=3306 –socket=/opt/lampp/var/mysql/mysql.sock
nobody    3929  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody    3930  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody    3931  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody    3932  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody    3933  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5
nobody    3957  3842  0 20:42 ?        00:00:00 /opt/lampp/bin/httpd -k start -DSSL -DPHP5

we can enhanced the startup script to accept argument like start, stop, restart.

Advertisements

Written by cahbojonegoro

January 5, 2009 at 4:02 pm

Posted in Ubuntu, Unix

Accessing Linux Host OS from Virtual Box Linux/Unix Guest

with one comment

Usually we use samba to access Linux Host Operating System from Linux/Unix Guest OS in VirtualBox.
But this is another way to get it done with small effort and better result 🙂

In this case, I have OpenSolaris 2008.11 running inside VBox on My Ubuntu Linux Host Operating System.
First, what we need is just install openssh-server.

sudo aptitude install openssh-server

It will then setup openssh-server and generate RSA Key.

Then, in OpenSolaris Inside VBox.
Open Nautilus File Manager.
Ctrl+L to go to address bar, then inside address bar type:

ssh://LinuxUserName@10.0.2.2/

( 10.0.2.2 is IP address of host OS from VirtualBox point of View )

Then, a password dialogue box will appear. Fill the password the the password of that particular LinuxUserName. You can choose remember forever in order not to be prompted to fill the password again.

That’s it, you already have access to root directory of Linux Host Operating System which is means you can access any file in Host OS from the Guest OS.

Using the same way we can access any Linux/Unix OS that have ssh enable from our Linux PC/Laptop. Say, you have tens of Linux/Unix server in your office, so you can access it using this way if you need to copy several file from/to the server. ( no need to ftp file one by one )

open nautilus

ssh://userName@IP-address/

Have Fun !!

Written by cahbojonegoro

December 22, 2008 at 1:59 pm

Posted in Ubuntu, Unix

Viewing Log File “live” – in Linux / Unix

leave a comment »

To get a live view of logfile.

User@Box$ tail -f /path/to/logfile
to quit – Ctrl+C

or

User@Box$ less /path/to/logfile
then : SHIFT+F
to quit – Ctrl+C then q

Maybe somebody have another way , please post it in comment.

Written by cahbojonegoro

December 21, 2008 at 2:51 pm

Posted in Ubuntu, Unix

CPU Temperature Monitor Script

with one comment

Sometimes in the office, i suddenly felt that my laptop is getting slower and slower. I was shocked when i looked at my conky output , that both CPU temperature is more than 80°C.
Immediately shutdown the laptop, Fix the circulation problem for CPU fan & it working normally again.
Then, i need some tool to prevent my CPU from getting burnt because of overheat. The simplest way is creating a shell script to monitor the CPU temperature and if it is exceeding predefined threshold, a shutdown command will be issued immediately.

Later, I came with this simple script.

#!/bin/sh

### Temperature Monitor
### Auto Shutdown if CPU Temperature is over threshold
### heri.cahyono@gmail.com

## Define threshold for CPU Temperature
threshold=80

## Get CPU Temperatur using lm-sensor
t1=`/usr/bin/sensors | nawk ‘/temp1/ {print substr($2,2,2)}’`
t2=`/usr/bin/sensors | nawk ‘/temp2/ {print substr($2,2,2)}’`

if test $t1 -gt $threshold || test $t2 -gt $threshold
then
echo “CPU Temperature is exceeding threshold – Shutting down in 5 sec …….”
sleep 5
shutdown -h now
else
echo “CPU Temperature still on the safe range ”
echo “Core1: $t1°C”
echo “Core2: $t2°C”
fi

The script utilize lm-sensors to detect the CPU temperature.
For Ubuntu/Debian users, it can be installed from repositories.

sudo apt-get install lm-sensors

then, configure lm-sensors to detect available sensors in the computer.

sudo sensors-detect

follow the instructions.

Written by cahbojonegoro

December 15, 2008 at 3:26 pm

Posted in Ubuntu, Unix

XAMPP for Solaris

leave a comment »

A few weeks ago, I success install XAMPP in my ubuntu box ( Compaq Pressario V300 ).
After that i’m trying to get it working in my Sun Server. I have a server located in the remote site of my Office and it is unusable, just used for Collecting Backup File from Network Element.

Lets start.
First we need to download the XAMPP package for solaris. We can get it from here.
Copy the package to your Sun Server.
Login as root to the server, then:
sh xampp-solaris-0.8.2.sh

The Installer will ask for installation path:

Where do you want to install XAMPP? (press Ctrl+C to quit)
[/opt/xampp]

Enter the path where you will install the XAMPP or just enter to accept default location.

That’s all, we already has XAMPP installed in solaris.

XAMPP
Now, I’ll configure wordpress or Drupal to make a local Blog that can be used for Knowledge sharing & Jobs Log in my workplace. 🙂

Written by cahbojonegoro

March 3, 2008 at 9:56 pm

Posted in Unix