Thursday, December 17, 2009

Make Own Startup Script on OpenWrt/Open-Mesh

---------- cut ---------------------


#!/bin/sh /etc/rc.common

start() {
  your code

}
stop() {
   your code
}

---------- cut ---------------


save and exit


#chmod 755 myfile


#/etc/init.d/myfile enable


now you can use it with start and stop


Saturday, December 12, 2009

Dell S2409W ( 24" Widescreen ) with Debian/Ubuntu/Linux Mint

This monitor support resolution up to 1920x1080 but i still can't make it work on maximum resolution for the monitor. My current setting was 1680x1050 and it work just great. How i did to make it works?

1. Download and install latest Nvidia drivers from www.nvidia.com

2. Once downloaded, press ALT+CTRL+F1 and login as root

3. Stop the current Xwindows with

/etc/init.d/gdm stop or /etc/init.d/kdm stop

or you can do this with command

service gdm stop or service kdm stop

4. run NVIDIA-.x.x.sh to install the driver and say YES to nvidia-xconfig

5. Edit the /etc/X11/xorg.conf and define this :

Section "Monitor"

VendorName   "Dell"
ModelName    "S2409W"
HorizSync       15.0 - 65.0
VertRefresh     50.0 - 75.0
Option             "DPMS"

End Section

save and exit

6.  Then run this for nvidia

nvidia-xconfig -render-accel
nvidia-xconfig -allow-glx-with-composite
nvidia-xconfig -composite
nvidia-xconfig -add-argb-glx-visuals
nvidia-xconfig -add-argb-visuals

7.startx or /etc/init.d/gdm start

it should works..

thank you for reading


Compiz desktop effect missing title bar

This guide for Nvidia. It might work on ATI..

put this in xorg.conf under Section "Device" before the End Section

Option "AddARGBVisuals" "True"
Option "AddARGBGLXVisuals" "True"

or

#sudo nvidia-xconfig --add-argb-glx-visuals -d 24

then restart X



Sunday, November 22, 2009

Server replied: 502 unimplemented (#5.5.1)

If you are using qmail, and get this error:

"Command not implemented

Server replied: 502 unimplemented (#5.5.1)"

Change SMTP Authentication to 'None' in the config (under SMTP Settings)

Thursday, November 19, 2009

PLESK failure: Sorry._Although_I'm_listed_as_a_best-preference_MX_or_A_for_that_host,/it_isn't_in_my_control/locals_file,_so_I_don't_treat_it_as_local

This usually happens when the name of the server is NOT in the locals file for qmail.

Check /var/qmail/control/locals (RPM) or /usr/local/psa/qmail/control/locals (standard)

In addition to localhost, this file should contain the name of the server ( by using hostname command ).


Sample:

localhost
ns1.mynux.net




Saturday, November 14, 2009

Saturday, October 3, 2009

Increase IE8 Connection Limit

The number of files that you can download simultaneously in Internet Explorer 7 or earlier versions is limited to 2 by default. When Internet Explorer 8 is released, this limitation has been increased to 6. Although the default connection allowed at one time has been increased significantly, but if you think that it still can’t fulfill your requirement and you want it to be more, you can actually increase it to up to 10 connections at one time.

To increase the number of files that can be downloaded simultaneously to 8 in Internet Explorer 8, it can be done via simple registry hack as shown below:

1. Open notepad.

2. Copy below string and paste it into notepad:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"MaxConnectionsPerServer"=dword:00000010
"MaxConnectionsPer1_0Server"=dword:0000010

3. One thing to take note here. Once you have copied the string to notepad, delete both ” (double quote) and retype. Without doing so could cause the value fail to be added into registry due to the double quote copy from the webpage is different from what you type manually. Save the notepad as “IncreaseConIE8.reg” with Save as type is “All Files”.

4. Double click the registry file, continue with UAC prompt and click OK to confirm you wish to perform the action.

Once you have completed the above steps, you should be able to download 10 files simultaneously by using Internet Explorer 8.

Tuesday, August 25, 2009

Kernel tuning for more aggressive network throughput

The Linux kernel and the distributions that package it typically provide very conservative defaults to certain network settings that affect networking parameters.

These settings can be tuned via the /proc filesystem or using the sysctl program. The latter is often better, as it reads the contents of /etc/sysctl.conf, which allows you to keep settings across reboots.

The following is a snippet from /etc/sysctl.conf that may improve network performance:

[code]net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_syncookies = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216[/code]

The above isn't to replace what may already exist in /etc/sysctl.conf, but rather to supplement it. The first command enables TCP window scaling, which allows clients to download data at a higher rate by enabling extra bits in TCP packets that are used to increase the window size.

The second command enables TCP SYN cookies, which is often enabled by default and is extremely effective in preventing conditions such as SYN floods that can drain the server of resources used to process incoming connections.

The last four options increase the TCP send and receive buffers, which allow an application to move its data out faster so as to serve other requests. This also improves the client's ability to send data to the server when it gets busy.

By adding these commands to the /etc/sysctl.conf file, you ensure they take effect on every reboot. To enable them immediately without a reboot, use:

[code]$sysctl -p /etc/sysctl.conf[/code]

To see all of the currently configured sysctl options, use:

[code]$sysctl -a[/code]

This will list all of the configuration keys and their current values. The sysctl.conf file allows you to configure and save new defaults; what you see from this output are the defaults defined in the kernel that are currently effective. To see the value of one particular item, use:

[code]$sysctl -q net.ipv4.tcp_window_scaling[/code]

Likewise, to set the value of one item without configuring it in sysctl.conf -- and understanding that it won't be retained across reboots, use:

[code]$sysctl -w net.ipv4.tcp_window_scaling=1[/code]

This can be useful for testing the effectiveness of certain settings without committing them to being defaults.

Tuning Linux kernel for more aggressive network throughput

Tuesday, August 4, 2009

Google Apps - a note for customer

Customer complaint cannot access to google apps by using their domain like http://mail.pmbk.gov.my

this problem should be from dns settings


double check the dns entry..

1) mail.pmbk.gov.my should have CNAME records to ghs.google.com

2) The MX records for that domain should go like this :-

pmbk.gov.my. IN MX 1 ASPMX.L.GOOGLE.COM.
pmbk.gov.my. IN MX 5 ALT1.ASPMX.L.GOOGLE.COM.
pmbk.gov.my. IN MX 5 ALT2.ASPMX.L.GOOGLE.COM.
pmbk.gov.my. IN MX 10 ASPMX2.GOOGLEMAIL.COM.
pmbk.gov.my. IN MX 10 ASPMX3.GOOGLEMAIL.COM.


reload bind and you're done

Wednesday, July 15, 2009

GPG Key error upon aptitude update

The error message looks like :

W: GPG error: http://security.debian.org etch/updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9AA38DCD55BE402B

Solution:-

as root

#gpg --keyserver subkeys.pgp.net --recv-keys 9AA38DCD55BE402B

we will get this message

gpg: directory `/root/.gnupg' created
gpg: can't open `/gnupg/options.skel': No such file or directory
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: requesting key 55BE402B from hkp server subkeys.pgp.net

gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 55BE402B: public key "Debian Archive Automatic Signing Key (5.0/lenny) " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)

next do:-

#gpg --armor --export 55BE302B | apt-key add -

then try aptitude update again

Thursday, June 11, 2009

There is no public key available for the following key IDs

when trying to apt-get update i got this error message :-
W: There is no public key available for the following key IDs xxxxxxxxxxxx
this problem was caused by change of gpg key used by ftpmaster on Debian official repository servers. Google gave me some information and I found some fix which works fine for me:
error :
W: There is no public key available for the following key IDs:
9AA38DCD5512345678
W: GPG error:
http://ftp.us.debian.org etch Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9AA38DCD5512345678
W: You may want to run apt-get update to correct these problems
DO!
find out invalid key. its 8 digits string from the right in my case my key id is 12345678
check the key id with
#apt-key list
find out if its there on not. the format should be xxxxx/our-key
if you found one then
#apt-get update
if not?
#gpg -a --export (error keyid here) | sudo apt-key add -
#apt-key update
#apt-key list
then try to apt-get update again
its work for me..

wak dogel

Monday, June 1, 2009

Smashing your brain

wow! wow! wow!

what is it?

world of windows?

world of women?

world of wind?

world of what?

and ......?

Using Mytop to monitor Mysql Server

a top like monitoring system for mysql

aptitude install mytop

edit /~/.mytop

put this

user=root
pass=xxxx
host=localhost
db=sangkancil
delay=5
port=3306
socket=/var/run/mysqld/mysqld.sock
batchmode=0
header=1
color=1
idle=1

give a try

Debian 5.x ( Lenny ) and Nvidia

just want to share..

Lenny just about confusing me a little bit when trying to configure X. i found no Module section on xorg.conf and no driver for VGA device. here what i did..

as root:-

#apt-get install module-assistant nvidia-kernel-common nvidia-xconfig
#m-a auto-install nvidia-kernel${VERSION}-source

then edit xorg.conf but first we make a backup ( always! )

#cd /etc/X11
#cp xorg.conf xorg.conf-old
#pico xorg.conf

put this if not exists

Section "Module"
Load "glx"
EndSection

then put following driver to VGA Device section

Section "Device"
Identifier "Configured Video Device"
Driver "nvidia"
EndSection

now you can restart X. Nvidia logo shown on your screen telling you that you are using nvidia driver

Monday, May 11, 2009

Tiny bash script to check internet connectivity

Sometimes it is necessary to check whether server you want to run some big bash script is connected to Internet. Usually it makes sense while running scripts periodically using cron. Below is the tiny bash script for this purpose:

#!/bin/bash
WGET="/usr/bin/wget"
$WGET -q --tries=10 --timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null
if [ ! -s /tmp/index.google ];then
echo "no"
else
echo "yes"
fi


As you see it tries to download google’s index page, if it’s not empty script returns “yes”, if there is not Internet connection available script will return “no”. If it is impossible to fetch the page in more than 5 seconds script will return “no” as well.

Limit bandwidth with squid

acl magicwords url_regex -i .rpm .exe .iso .avi .mp3 .tar.gz .tar

delay_pools 1
delay_class 1 2
delay_parameters 1 5000/15000 5000/15000
delay_access allow magicwords

this will limit the bandwidth to 5 Kbps when the download reach 15 Kbps or more

thanks for squid cache guy

Who's behind linux?

What/who you imagine when you hear the names "Ubuntu", "Debian", "Slackware", etc? Is this tux, penguin, disribution logo? Have you ever wondered who is behind certain Linux distribution?
Ian Murdock -- Debian LinuxIan Murdock (left) founded Debian while a student in 1993. He named Debian after himself and his then-girlfriend Debra, now his ex-wife, thus Deb(ra) and Ian.
From
Ian's blog:
Debian was one of the first Linux distributions and arguably the first open source project that explicity set out to be developed in a decentralized fashion by a group of volunteers. Today, over 1,000 volunteers are involved in Debian's development, and there are millions of Debian users worldwide.


Mark Shuttleworth -- Ubuntu LinuxMark Shuttleworth (right) who founded Ubuntu Linux was the second space tourist and one of Debian's key developers. His biography is too interesting to be published here so just use google to get more facts. Mark:
I can pay, however, because ten years ago when I was still studying at the University of Cape Town in South Africa… Linux allowed me to compete with the best companies in the world, without any obstacles between me and success. That made me a billionaire; so I could fly into space and do many other wonderful things.
Gael Duval -- Mandriva LinuxGaël Duval (left) was born 1973. He is a graduate of the Caen University in France where studied networks and documentary applications. In July 1998, he created Mandrake Linux (now Mandriva Linux), a Linux distribution originally based on Red Hat Linux and KDE. He was also a co-founder of MandrakeSoft (now merged in Mandriva) with Jacques Le Marois and Frédéric Bastok. Gaël Duval was responsible for communication in the Mandriva management team until he was laid off by the company in March 2006, in a round of cost-cutting. Duval suspected part of the reason for his dismissal was disagreement with management over the company's future strategy, resulting in a lawsuit against the company. Gael:
It was clear for me that Linux had the potential to be an excellent alternative to Windows, or maybe even a full replacement, and at the time I thought that it would be good to provide a Linux distribution that would be as easy to use as Windows.
Patrick Volkerding -- Slackware LinuxPatrick Volkerding (right) was born 20th October 1966. He is the founder and maintainer of the Slackware Linux distribution. He is the "Slackware Benevolent Dictator for Life". Volkerding earned a Bachelor of Science in computer science from Minnesota State University Moorhead in 1993. Patrick in 1994:
Linux is my big fun project right now - gets pretty crazy sometimes trying to keep up with all of the development going on; for instance, last week the new C libraries, GCC, and kernel were all released within a couple days of each other. Luckily, I like keeping my machine current. Judging from the mail I get when things fall a bit behind, so does everyone else.
Daniel Robbins -- Gentoo LinuxDaniel Robbins (left) is best known as a founder of Gentoo Linux project. During his time as a system administrator at the University of New Mexico in Albuquerque Robbins first came into contact with Linux. He became a developer on Stampede Linux, and later formed his own distribution Enoch Linux, which was later renamed Gentoo in 2002.
Daniel in 2007:
The logic is as follows: it is impossible to write a kernel module without it being a derivative work of the kernel, which is GPL, so in turn the module itself must be distributed under the terms of the GPL and thus cannot be binary-only/proprietary in nature.
To be continued…

Saturday, May 9, 2009

Squid from malaysia network only

Hmm.. sorry to say.. i have ran an open proxy for a years to create a caches between my server and my school's LAN because of leak network bandwidth supplied by GITN. Someone at JPN's forum laughing at me for doing this but it's just fine maybe they have no clue about it. The Websense Enterprise used by GiTN guys for cache and filters the usage does make a sense. As far as i know they are running up to upgrade their network. For me the squid cache does improve web browsing but i cannot compare how effectively using the squid or websense because i never try it ( i'm not using windows as a server )..rather use then nothing.. i did it as a parent peer for my lab ( Luckily i have my own server ).

From now i have decided to close my open proxy for malaysian use only.. here what i did

Get the network list from http://www.ipdeny.com/ipblocks/data/countries/my.zone

edit /etc/squid/squid.conf and add :

---------------- START -------------------------

acl my1 src 58.26.0.0/16 58.27.0.0/17 58.71.128.0/17 58.139.0.0/16
acl my2 src 60.48.0.0/14 60.52.0.0/15 60.54.0.0/16
acl my3 src 61.4.96.0/20 61.4.112.0/20 61.6.0.0/17 61.6.128.0/18 61.11.208.0/20
acl my4 src 110.4.40.0/21 110.74.128.0/18 110.159.0.0/16
acl my5 src 112.137.160.0/20
acl my6 src 113.21.128.0/19 113.23.128.0/17 113.210.0.0/15 113.212.108.0/22
acl my7 src 114.133.0.0/16
acl my8 src 115.132.0.0/14 115.146.96.0/20 115.164.0.0/16
acl my9 src 116.0.96.0/19 116.197.0.0/17 116.206.0.0/16
acl my10 src 118.100.0.0/15 118.107.192.0/18
acl my11 src 119.40.112.0/20 119.110.0.0/18 119.110.96.0/20 119.110.128.0/17 119.161.96.0/21
acl my12 src 120.50.48.0/20 120.138.80.0/20 120.139.0.0/16 120.140.0.0/15
acl my13 src 121.120.0.0/15 121.122.0.0/15
acl my14 src 122.0.16.0/20 122.255.96.0/19
acl my15 src 123.136.96.0/19
acl my16 src 124.13.0.0/16 124.82.0.0/16 124.158.224.0/19 124.195.128.0/20 124.197.224.0/19 124.217.224.0/19
acl my17 src 144.199.0.0/16
acl my18 src 161.139.0.0/16 161.142.0.0/16
acl my19 src 170.38.0.0/16
acl my20 src 192.228.128.0/24 192.228.129.0/24 192.228.130.0/24 192.228.131.0/24 192.228.132.0/22 192.228.136.0/22
acl my21 src 192.228.140.0/24 192.228.141.0/24 192.228.142.0/24 192.228.143.0/24 192.228.144.0/24 192.228.145.0/24
acl my22 src 192.228.146.0/24 192.228.147.0/24 192.228.148.0/24 192.228.149.0/24 192.228.150.0/24 192.228.151.0/24
acl my23 src 192.228.152.0/24 192.228.153.0/24 192.228.154.0/24 192.228.155.0/24 192.228.156.0/24 192.228.157.0/24
acl my24 src 192.228.158.0/24 192.228.159.0/24 192.228.160.0/24 192.228.161.0/24 192.228.162.0/24 192.228.163.0/24
acl my25 src 192.228.164.0/24 192.228.165.0/24 192.228.166.0/24 192.228.167.0/24 192.228.168.0/24 192.228.169.0/24
acl my26 src 192.228.170.0/23 192.228.172.0/23 192.228.174.0/24 192.228.175.0/24 192.228.176.0/24 192.228.177.0/24
acl my27 src 192.228.178.0/24 192.228.179.0/24 192.228.180.0/22 192.228.184.0/22 192.228.188.0/22 192.228.192.0/24
acl my28 src 192.228.193.0/24 192.228.194.0/24 192.228.195.0/24 192.228.196.0/24 192.228.197.0/24 192.228.198.0/24
acl my29 src 192.228.199.0/24 192.228.200.0/22 192.228.204.0/23 192.228.206.0/24 192.228.207.0/24 192.228.208.0/23
acl my30 src 192.228.210.0/24 192.228.211.0/24 192.228.212.0/24 192.228.213.0/24 192.228.214.0/24 192.228.215.0/24
acl my31 src 192.228.216.0/23 192.228.218.0/24 192.228.219.0/24 192.228.220.0/24 192.228.221.0/24 192.228.222.0/24
acl my32 src 192.228.223.0/24 192.228.224.0/20 192.228.240.0/21 192.228.248.0/24 192.228.249.0/24 192.228.250.0/24
acl my33 src 192.228.251.0/24 192.228.252.0/22
acl my34 src 202.0.94.0/24 202.9.96.0/20 202.21.148.0/24 202.45.132.0/22 202.45.136.0/21 202.46.112.0/20 202.47.160.0/19
acl my35 src 202.56.80.0/20 202.58.80.0/20 202.60.56.0/22 202.71.96.0/20 202.73.8.0/21 202.75.4.0/22 202.75.32.0/20
acl my36 src 202.75.48.0/20 202.75.128.0/19 202.75.160.0/19 202.75.240.0/21 202.76.224.0/20 202.83.120.0/21 202.87.216.0/21
acl my37 src 202.94.160.0/20 202.122.144.0/20 202.129.160.0/20 202.133.96.0/20 202.137.252.0/22 202.144.192.0/20
acl my38 src 202.146.64.0/20 202.146.80.0/20 202.151.192.0/18 202.162.0.0/19 202.165.0.0/19 202.168.64.0/20 202.169.24.0/21
acl my39 src 202.170.48.0/20 202.171.32.0/20 202.171.48.0/20 202.171.192.0/20 202.176.12.0/24 202.176.13.0/24 202.178.0.0/19
acl my40 src 202.178.32.0/19 202.178.64.0/20 202.179.96.0/19 202.184.0.0/15 202.186.0.0/15 202.188.0.0/22 202.188.4.0/22
acl my41 src 202.188.8.0/21 202.188.16.0/20 202.188.32.0/19 202.188.64.0/18 202.188.128.0/18 202.188.192.0/18 202.190.0.0/16
acl my42 src 202.191.0.0/24 202.191.128.0/17
acl my43 src 203.10.16.0/21 203.12.220.0/24 203.62.1.0/24 203.78.192.0/20 203.80.16.0/21 203.82.64.0/19 203.92.128.0/19
acl my44 src 203.99.136.0/22 203.106.0.0/18 203.106.64.0/18 203.106.128.0/20 203.106.144.0/20 203.106.160.0/19
acl my45 src 203.106.192.0/18 203.109.32.0/19 203.112.224.0/19 203.115.192.0/20 203.115.208.0/20 203.115.224.0/19
acl my46 src 203.119.57.0/24 203.121.0.0/19 203.121.32.0/19 203.121.64.0/18 203.142.32.0/19 203.148.88.0/22 203.153.16.0/21
acl my47 src 203.153.80.0/20 203.158.24.0/21 203.161.32.0/19 203.176.144.0/21 203.188.232.0/21 203.189.16.0/21
acl my48 src 203.201.182.0/24 203.201.184.0/22 203.215.60.0/22 203.223.128.0/19
acl my49 src 210.5.40.0/21 210.19.0.0/17 210.19.128.0/17 210.48.144.0/20 210.48.192.0/20 210.48.216.0/21 210.186.0.0/17
acl my50 src 210.186.128.0/17 210.187.0.0/17 210.187.128.0/17 210.195.0.0/16
acl my51 src 211.24.0.0/17 211.24.128.0/17 211.25.0.0/16
acl my52 src 218.100.18.0/24 218.100.22.0/24 218.100.44.0/24 218.100.58.0/24 218.111.0.0/16 218.208.0.0/16
acl my53 src 219.92.0.0/15 219.94.0.0/17 219.95.0.0/16
acl my54 src 221.133.32.0/21 221.133.40.0/21


http_access allow my1
http_access allow my2
http_access allow my3
http_access allow my4
http_access allow my5
http_access allow my6
http_access allow my7
http_access allow my8
http_access allow my9
http_access allow my10
http_access allow my11
http_access allow my12
http_access allow my13
http_access allow my14
http_access allow my15
http_access allow my16
http_access allow my17
http_access allow my18
http_access allow my19
http_access allow my20
http_access allow my21
http_access allow my22
http_access allow my23
http_access allow my24
http_access allow my25
http_access allow my26
http_access allow my27
http_access allow my28
http_access allow my29
http_access allow my30
http_access allow my31
http_access allow my32
http_access allow my33
http_access allow my34
http_access allow my35
http_access allow my36
http_access allow my37
http_access allow my38
http_access allow my39
http_access allow my40
http_access allow my41
http_access allow my42
http_access allow my43
http_access allow my44
http_access allow my45
http_access allow my46
http_access allow my47
http_access allow my48
http_access allow my49
http_access allow my50
http_access allow my51
http_access allow my52
http_access allow my53
http_access allow my54


#deny all lah!
http_access deny all


--------------------- END --------------

save and exit

restart squid

FUYOH!!!! lenguh tangan aku taip...


Automatic Email Notification When Security Upgrades Available

LOL..

i didn't notice that in debian ( maybe in other also try it ) there is an application which check the available updates and email us a notification called "APTICRON".

here's what i did:-

aptitude install apticron

then.. edit /etc/apticron/apticron.conf

change the EMAIL="root" to EMAIL="your@domain.com"

you're done!

the script in /etc/cron.daily/apticron will do the rest

/etc/init.d/cron restart to active

Restore zimbra backup

#!/bin/bash

domain="@my.domain"
backupdir="/root/backup/users"

if [ $# -ne 2 ]; then
echo "Usage: $0 account [reset, skip]"
exit 1
fi

case "$2" in
reset)
OPTION="reset"
;;
skip)
OPTION="skip"
;;
*)
echo "Usage: $0 account [reset, skip]"
exit 3
esac

echo "Start to restore => `date`"

echo -n "Check account [$1] ==> "
sudo -u zimbra /opt/zimbra/bin/zmprov ga $1$domain > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "NO, [$1] not exist"
exit 2
else
echo "Yes, we have [$1]"
fi

echo -n "Check backup data for [$1] ==> "
if [ ! -e $backupdir/$1.tgz ]; then
echo "No, no backup data for [$1]"
exit 3
else
echo "Yes, backup data for [$1] exists"
fi

echo -n "Start to restore user [$1] ==> "
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $1$domain postRestURL "//?fmt=tgz&resolve=$OPTION" $backupdir/$1.tgz

if [ $? -eq 0 ]; then
echo "OK"
else
echo "Fail"
fi

echo "Restore finish => `date`"

Zimbra backup all users

#!/bin/bash

domain="@my.domain"
backupdir="/root/backup/users"

echo "Start to backup => `date`"

if [ ! -d $backupdir ]; then
echo "$backupdir not existing, create it now automatically"
mkdir -p $backupdir
fi

index=1
sudo -u zimbra /opt/zimbra/bin/zmprov gaa |
while read line; do
echo -n "[$index]backup user : $line..."
username=`echo $line | cut -d@ -f1`
sudo -u zimbra /opt/zimbra/bin/zmmailbox -z -m $line getRestURL "//?fmt=tgz" > $backupdir/$username.tgz
if [ $? -eq 0 ]; then
echo "OK [`du -h $backupdir/$username.tgz | awk '{print $1}'`]"
else
echo "Fail"
fi

index=`expr $index + 1`
done

echo "Backup finish => `date`"

Getting mysql root password for zimbra

I have to....

Must...

Felt guilty...

do this to get zimbra mysql password

/opt/zimbra/bin/zmlocalconfig -s | grep mysql | grep password

then what?

/opt/zimbra/bin/mysql -uroot -p -P 7306

waaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Wednesday, April 8, 2009

php script to update song info using command line


/*
* Script By Mynux Team 2008
*
* I use this script to update the song info as advertisement
* for a running shoutcast server and running with cron.
*
* http://www.mynux.net
*/

/************** EDIT HERE ONLY **********/

$host = "my.fm";
$port = "8000";
$scpass = "adminpass";
//the text in between cannot have blank space. put %20 between them
$msg = "Radio%20Manis%20-%20Powered%20by%20www.mynux.net";

/**************** END HERE **************/

$fp = fsockopen($host, $port, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)
\n";
} else {
$out = "GET /admin.cgi?mode=updinfo&song=$msg HTTP/1.1\r\n";
$out .= "Host: $host:$port\r\n";
$out .= "Accept: */*\r\n";
$out .= "User-Agent: MynuxCast Song (Mozilla Compatible)\r\n";
$out .= "Authorization: Basic ".base64_encode("admin:$scpass")."\r\n\r\n";
fputs($fp,$out);
fclose($fp);
}
?>

Saturday, March 7, 2009

Mysql Replication : slave I/O stopped

whoa! problems.. problems..problems.. mysql replication system down.. looks like the slave data did not replicate from the master. The slave do not know what point in which binlog to start so i have to fix it by hand..what i do is :-

On Master

mysql> show master status;

write down master log file name and current positions. lets say the master file is server-bin-007 and the positions on 111000 . On slave now we must tell the slave server to read the current file and positions.

On Slave

mysql> slave stop;
mysql> change master to master_log_file='server-bin-007', master_log_pos=111000;
mysql> start slave;

confirm that I/O is running with

mysql> show slave status\G;

now the slave knows which point to start..

i'm a broken man splitted into pieces like a cheese thats why i'm using poor and broken english.

 Simple Python Calculator This script will allows your to calculate the integers given with the chosen operation. You can add, substract, mu...