Tuesday, April 28, 2015

Backup Pemalas - Linux

#!/bin/bash
# backup from Shinjriu Web Hosting to Server 10.1.XX.XX dir /home/backup

OUTPUT=`rsync --bwlimit=250 -avzhe ssh --progress root@124.217.245.XXX:/backup /home/backup`

CURDATE=`date`
sendmail -oi harithd@xxxxxxxx.com << EOF
From: Sysadmin
To: harithd@xxxxxxxx.com
Subject: SERVER INFO: Backup Done on $CURDATE

Salam..

The server has just Rsync Backup dir on Shinjiru server to BackupServer on $CURDATE.


Backup Output:

$OUTPUT

EOF

Friday, January 10, 2014

Simple Backup Script Using WinSCP

Simple backup script using WinSCP

===================================================
echo off

SET HOUR=%time:~0,2%
SET dtStamp9=%date:~-4%%date:~4,2%%date:~7,2%_0%time:~1,1%%time:~3,2%%time:~6,2% 
SET dtStamp24=%date:~-4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%%time:~6,2%

if "%HOUR:~0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%)

cd C:/backup
mkdir %dtStamp%
cd %dtStamp%
mkdir database
mkdir homedir


"C:\WinSCP\WinSCP.com" /command "open root:password@10.1.20.103" "option batch abort" "option confirm off" "option exclude log/" "cd /backup/mysql-daily-backup" "lcd C:/backup\%dtStamp%\database" "get *" "cd /home/" "lcd C:/backup\%dtStamp%\homedir" "get *"

===================================================


Change Webmin Default Port 10000

Go to Terminal and edit following config file:
vi /etc/webmin/miniserv.conf

    find port=10000 and change to other value


-
Harith

Saturday, February 13, 2010

FreeBSD command to stop IPFW Firewall

To stop the firewall, issue the command: 
# /etc/rc.d/ipfw stop
To disable firewall remove following line from /etc/rc.conf file:
firewall_enable="YES"
OR set it as follows:
firewall_enable="NO"

Optimize PHP Linux Web Server

Open php.ini configuration file.
vi /etc/php.ini
Find and change to following value:-
max_execution_time = 30
max_input_time = 30
memory_limit = 40M
post_max_size = 8M
upload_max_filesize = 2M
file_uploads = Off (Turn off if it really not use.)
cgi.force_redirect = 0
allow_url_fopen = Off
sql.safe_mode = Off
Reload Apache, using following command:-
server httpd reload
or
/etc/init.d/httpd reload

Monday, February 08, 2010

Suggestion #1 for my final year project : Cloud Computing

Now i thinking to develop could computing, i don't sure how to be done. Maybe start with private cloud computing first and more research need to be done too.... Looks ubuntu cloud much easier, now in stage installing Ubuntu server....hahhaa...pening kepala edeng..





Saturday, February 06, 2010

namebench : DNS Benchmark Utility

Namebench use to find out the fastest DNS servers available for your computer to use. Namebench run benchmark using your web browser history, tcpdump output, or standardized datasets in order to provide an individualized recommendation.



This is the result from my benchmarking




I got Google Public DNS is the fastest and followed by P1 DNS server... maybe Google DNS server it the fastest in term of speed, but from my experience, Level 1 (4.2.2.1,4.2.2.2,4.2.2.3,4.2.2.4) DNS server the fastest propagated DNS.

To install:-

Download here.


tar -zxvf namebench-1.0.5.tgz
cd namebench-1.0.5/
python setup.py install
./namebench.py

Friday, February 05, 2010

ip_conntrack: table full, dropping packet

Happen on my old freaking old server this afternoon....i unable to SSH into server at all...and need to physical access and here what i got after plugged the monitor...
ip_conntrack: table full, dropping packet
keep coming and coming... to solve this issue, i need to increase it value..but before that need to check current value first. To do so, need run following command.
cat /proc/sys/net/ipv4/ip_conntrack_max
to find out current usages:-
cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count
Temporary solve this issue by increase the value
echo 191072 > /proc/sys/net/ipv4/ip_conntrack_max
To make the permanent changes, i need to change value from kernel it self, so i edit this file
vi /etc/sysctl.conf
and add this value at the end of file
net.ipv4.ip_conntrack_max=191072
and update the kernel with latest configuration by exec this command
sysctl -p


Simple Password Generator

Edit this file .bashrc at your home dir.
sudo vi /home/harith/.bashrc

add following script at the end
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs }
Open your terminal and run this command to generate random password

genpasswd 16

Example:

harith@thinkmachine:~$ genpasswd 16
Br1WleFsmhJ4Dkwb
harith@thinkmachine:~$

FreeBSD 8.0

So far so good....i like it...

Monday, December 21, 2009

Kenduri Kahwin Mesti Ikut Batas Ditetap Syariat

SINONIM dengan musim cuti persekolahan akan datang, ramailah kalangan anggota masyarakat mengambil

kesempatan untuk mengadakan kenduri kahwin melambangkan kegembiraan dan kesyukuran lantaran bercantum dua hati insan dalam ikatan pernikahan.

Tidak kira di bandar atau kampung, kenduri kahwin berlangsung dalam suasana meriah tanpa mengira kecil

atau besar sambutan mengikut kemampuan ekonomi pengantin dan keluarga yang mengadakannya.

Anas bin Malik dalam hadis diriwayatkan Bukhari dan Muslim bahawa Rasulullah SAW melaksanakan majlis kenduri kahwin dengan seekor kambing untuk isterinya dan juga untuk Zainab.

Jelas daripada mafhum hadis itu bahawa hukum mengadakan walimah atau kenduri perkahwinan adalah diharuskan sebagai mengumumkan suatu ikatan pernikahan, tetapi hendaklah mengikut batas ditetapkan syariat Islam.

Menurut pandangan Syed Sabaq dalam salah sebuah kitabnya, beliau menerangkan walimah atau kenduri kahwin dapat dilaksanakan ketika berlangsungnya akad nikah atau sesudahnya.

Diriwayatkan oleh Bukhari menyatakan bahawa Rasulullah SAW mengundang sahabat Baginda untuk menghadiri majlis walimah sesudah Baginda mencampuri isterinya iaitu Zainab.

Pada kisah Abi Usaid juga didapati bahawa walimah yang dilakukan beliau di mana Rasulullah menghadirinya,

Abu Usaud menghidangkan kurma yang disimpan pada malam harinya. Ia bermakna, makanan yang ingin dihidangkan pihak keluarga yang mengadakan walimah itu terpulanglah kepada kemampuan mereka.

Yang ingin dijelaskan daripada kisah itu, Islam memberi perhatian istimewa terhadap majlis kenduri kahwin sebagai tanda penghebahan kepada masyarakat bahawa suatu ikatan pernikahan sudah berlangsung dalam keluarga berkenaan.

Namun begitu, dalam mengadakan majlis kenduri kahwin ini, janganlah pula ada di kalangan keluarga Islam yang mengadakannya dengan melampau batas syariat.

Allah berfirman yang bermaksud: “Sesungguhnya orang-orang yang boros itulah saudara syaitan. Dan syaitan itu adalah sangat ingkar kepada Tuhannya.”

Sudah menjadi budaya masyarakat barangkali, apabila golongan mewah dan kaya mengadakan kenduri kahwin, jarang sekali mendahulukan orang miskin serta kurang berada sebagai tetamu.

Hal ini dijelaskan Rasulullah SAW dalam sabdanya bermaksud: “Sejelik-jelik makanan ialah makanan dari majlis kenduri kahwin yang hanya dijemput orang-orang kaya saja, orang-orang fakir dan miskin tidak pula diundang untuk makan bersama.” (Hadis riwayat Bukhari)

Rasulullah bersabda yang bermaksud: “Jika salah seorang di antara kamu dijemput ke majlis perkahwinan, maka hendaklah ia mendatangi majlis tersebut.” (Hadis riwayat Bukhari)

Dalam kitab yang ditulis Syed al-Bari ada menyatakan bahawa syarat undangan yang wajib dipenuhi antara lain hendaklah meliputi perkara berikut:

- Orang yang mengundang adalah mukallaf, merdeka serta sihat pemikirannya.
- Tidak dikhususkan kepada orang kaya saja.
- Orang mengundang beragama Islam.
- Tidak ada kemungkaran.
- Orang yang diundang tidak mengalami keuzuran syarie.

---------------------------------------------------------------------
Sumber: Agama
berita harian
7 JamadilAwal 1428H
24 Mei 2007

URL : http://halaqah.net/

Sunday, November 22, 2009

Merantau : The Movie


"Merantau" filem dari Indonesian, yang menceritakan seorang budak minang yang mahir dalam seni mempertahankan diri (Silat Harimau) ... menarik cerita ni....terutamanya yg suka seni mempertahankan diri atau selalu dok tengok cerita aksi lawan...mcm cerita Ombak ...hehe

Facebook Merantau
Website Merantau

Monday, November 16, 2009

Google Wave : Siri Tayangan

Google Wave, alat kolaborasi terbaru yang akan mengantikan email kelak. Google Wave ni masih dalam pembinaan. Buat masa ni masih dalam status penayangan ja dulu. Tak hairan la aku pakai macam lembab dan "buggy" sikit.

Buat masa ni, hanya pengguna google yang diajak sahaja dapat menggunakan Google Wave, kalau tak sabar sgt... isi borang ni untuk mintak Google pelawa cuba..hehe.. Nak pelawa rakan lain pakai dan cuba tapi apakan daya..dah habis dah...hehe

https://services.google.com/fb/forms/wavesignup/


Tak sabar.... bila nak siap Google Wave nih...... ;)

Friday, August 07, 2009

Clear queue mails in QMail Server

1) wget http://www.japanitup.com/scripts/qmailclear.sh
2) sh qmailclear.sh


[root@www home]# /var/qmail/bin/qmail-qstat
messages in queue: 0
messages in queue but not yet preprocessed: 0
[root@www home]#

Mysql is not running but lock exists issue

/etc/init.d/mysql status

coming back with:

mysql is not running but lock exists


Solved by removing the lock file:

rm /var/lock/subsys/mysql

Sunday, July 12, 2009

MySQL Error : mysql is not running but lock exists

/etc/init.d/mysql status


coming back with:

mysql is not running but lock exists


Solved by removing the lock file:

rm /var/lock/subsys/mysql

Sunday, March 29, 2009

Installing JBoss Java Application Server in RHEL / CentOS 5

Just execute following command:-

yum install java-1.5.0-sun-devel jbossas


For old RHEL use following command:-

up2date -i java-1.5.0-sun-devel jbossas


Done.

Saturday, March 28, 2009

Monitor Network Usage / Network Status

Debain / Ubuntu Installation


Install by using following command:-

sudo apt-get update
sudo apt-get install ntop


Centos / RedHat Installation

Download the RPM packages:-

http://dag.wieers.com/rpm/packages/ntop/
http://rpmfind.net/linux/RPM/fedora/4/i386/glib-1.2.10-16.i386.html


Install all RPM packages using following command:-

rpm -ivh  glib-1.2.10-16.i386.rpm
rpm -ivh ntop-3.2-1.el4.rf.i386.rpm


After finish installion ntop for both, need to setup the admin password:-

/usr/sbin/ntop -A
OR
sudo /usr/sbin/ntop -A


Restart ntop service:-

/etc/init.d/ntop restart


by default ntop using port 3000, verify by using following command:-

netstat -tulpn | grep :3000


follow this link to view network status and usgae:-

http://localhost:3000/
or
http://{IP number}:3000/


ntop_preview

Install Suhosin as extension / PHP harden

Download the latest version of suhosin:-

wget http://download.suhosin.org/suhosin-0.9.27.tgz


Suhosin required php-devel:-

yum install php-devel


Install suhsosin:-

cd suhosin-0.9.27
phpize
./configure
make
make install


Congfirue Suhosin congiguration file:-

echo 'extension=suhosin.so' > /etc/php.d/suhosin.ini


Restart your webserver..
blockquote>
/etc/init.d/httpd restart

Check your suhsosin:-
php -v

or crate phpinfo page.

Locate Table Consuming High Resources

You need to install perl modules:-

cpan -i Term::ReadKey
cpan -i Term::ANSIColor
cpan -i Time::HiRes


after that, install mytop

wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
tar -zxvf mytop-1.6.tar.gz
cd mytop-1.6
perl Makefile.PL
make
make test
make install


mirror : wget http://notepad.harithdawi.com/files/mysql/mytop-1.6.tar.gz

execute below command (mydb is the database name)

mytop -u dba -p 'password' -h 10.2.4.5 -d mydb



  • -u : Database username.

  • -p : Database password.

  • -h : Database server IP address.

  • -d : Database name