Archive for April, 2007

Find Your IP Address

Did you ever wonder, what is your IP address? Maybe you’re going out your work or other NAT and just need to find out what your IP is. It’s really easy to make a web page that tells you what your IP address is. So, when I googled for one once I was blown away how many pages there are out there that’ll tell you your IP, so I wanted to be like them…

Your IP Address is : < ?php print "$_SERVER[REMOTE_ADDR]"; ?>

, ,

No Comments

MySQL backup sript – more info

Here’s my script to backup mysqlTo install it on a linux/freebsd box just edit the top parts for configuration. If you make a user mysqldump with home directory of /home/mysqldump and a mysql password of p@assword, make a /home/mysqldump/logs and /home/mysqldump/bkup directories, this should just work. Hack it up, it’s GPL’d.

Please email me updates you make and I will post them here. My email is kgb@bluesun.netThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it

More “in depth” installation:

adduser mysqldump
passwd mysqldump
mysql -p
GRANT select,lock tables on *.* to mysqldump@localhost identified by ‘p@ssword’;
flush privileges;
su – mysqldump
mkdir ~/bin
mkdir ~/logs
mkdir ~/bkup
cd ~/bin
wget http://www.submarinefund.com/backup_mysql/backup_mysql
chmod u+x backup_mysql
vi backup_mysql
make changes to config
– change passwd to the same one you used on the
GRANT instead of p@ssword
– change num_days_keep to the number of days you want to keep around

– change all the commands to match your system, these
should be the same on most linux systems, BSD’s may
need to change some paths

test the script

add a line to your crontab like this
0 3 * * * /home/mysqldump/bin/backup_mysql >> /home/mysqldump/logs/cron.log 2>&1

script gzipped

script txt

script zip zipped

, ,

No Comments

MySQL backup script

I wrote this script because I needed to have each table in all databases backed up separately.
If you have hundreds or thousands of tables and and want to back them up separately then this script could help. It also names and rolls files by unix timestamp, and allows you to specify
how long a file is kept, regardless of number of backups made. So, say you want 2 days of backups, and you make one every hour (48 total) it will auto roll them after 2 days, suppose then you manually run the script to create a backup before some important change or event, this will still keep that backup for 2 days.

Here’s my script to backup mysql

To install it on a linux/freebsd box just edit the top parts for configuration. If you make a user mysqldump with home directory of /home/mysqldump and a mysql password of p@assword, make a /home/mysqldump/logs and /home/mysqldump/bkup directories, this should just work. Hack it up, it’s GPL’d.

Please email me updates you make and I will post them here. If you have questions you can email me, or post them on my LCoD message board. My email iskgb@bluesun.netThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it, but I don’t really check it that much ;)

More “in depth” installation:
adduser mysqldump
passwd mysqldump
mysql -p
GRANT select,lock tables on *.* to mysqldump@localhost identified by ‘p@ssword’;
flush privileges;
su – mysqldump
mkdir ~/bin
mkdir ~/logs
mkdir ~/bkup
cd ~/bin
wget http://www.submarinefund.com/backup_mysql/backup_mysql
chmod u+x backup_mysql
vi backup_mysql
make changes to config
- change passwd to the same one you used on the
GRANT instead of p@ssword
- change num_days_keep to the number of days you want to keep around

- change all the commands to match your system, these
should be the same on most linux systems, BSD’s may
need to change some paths

test the script

add a line to your crontab like this
0 3 * * * /home/mysqldump/bin/backup_mysql >> /home/mysqldump/logs/cron.log 2>&1

, , ,

No Comments

Linux on my zt1150

How to install Linux on a Pavilion zt1150
Need help with Linux? Go to the Linux Command of the Day site (LCOD on left menu)

updated 5/31/07
If you want to install Linux on any computer for desktop/laptop use I recommend
you download Ubuntu and install that. It’s much easier and pretty much everything works.
http://www.ubuntu.com/

updated 4/27/04

I found another site with a zt1000 series laptop today while surfing for info, here’s a link
updated 4/21/04
Index:

Kernel 2.6.1
Kernel 2.6.0
What works/doesn’t work
Major Issues
Install Gentoo/RedHat/Mandrake notes
Wireless howto
Config/kernel files
All links from page summary
Old zt1150 page
My Linux Command of the Day site

Kernel 2.6.1
My 2.6.1 HP ZT1150 Kernel Config file
I just upgraded to 2.6.1 today (1/23/04) to see if my touchpad started working normally again, no luck. So I did some surfing, and found a Synaptics mouse driver, installed it and am happily using my scrolling and tap again. Synaptics Driver . One note, their documentation says you need to set CONFIG_MOUSE_PS2_SYNAPTIC set in the kernel config, and I can’t find this option. If I set it and rebuild (running genkernel) when I load the edited config file, then save it out somewhere else, it drops this option. I’ve got a stock 2.6.1 vanilla kernel, downloaded from kernel.org.
Their documentation online isn’t as complete. I downloaded the tar.gz file and after untarring it (tar -zxvf filename.tar.gz), I went into the synaptics directory created and looked at the INSTALL file. Basically you make, make install from the dir. Then edit /etc/X11/XF86Config-4 commented out my device section, added the device section straight from the INSTALL doc, and added a Load “synaptics” at the bottom of my other Loads in the same file. Here’s the Load line
Load “synaptics”

And here’s the Input section
Section “InputDevice”
Driver “synaptics”
Identifier “Mouse0″
Option “Device” “/dev/psaux”
Option “Protocol” “auto-dev”
Option “LeftEdge” “1900″
Option “RightEdge” “5400″
Option “TopEdge” “1900″
Option “BottomEdge” “4000″
Option “FingerLow” “25″
Option “FingerHigh” “30″
Option “MaxTapTime” “180″
Option “MaxTapMove” “220″
Option “VertScrollDelta” “100″
Option “MinSpeed” “0.02″
Option “MaxSpeed” “0.18″
Option “AccelFactor” “0.0010″
Option “SHMConfig” “on”
# Option “Repeater” “/dev/ps2mouse”
EndSection
Notice that my Identifier is “Mouse0″ You may have something else, like “Mouse1″ or “FrankenMouse”, or whatever, this just needs to match what you have on your InputDevice line, like mine says
Section “ServerLayout”
Identifier “Anaconda Configured”
Screen 0 “Screen0″ 0 0
InputDevice “Mouse0″ “CorePointer”
InputDevice “Keyboard0″ “CoreKeyboard”
EndSection
I uploaded a new screenshot , just for kicks.. I’ve started using Gnome on my laptop for some reason.. I think originally it was sound worked better, but I think I leave it on becuase it make my laptop feel more structured and more like a tool with a bunch of buttons to press. Not what I want on my desktop (enlightnment still on there), where I want free form, big mess of open terminals/documents/browsers.

One problem that I’ve always had, even with Windows laptops, is that if you get too much static buildup walking around and touch the touchpad before you’ve grounded yourself you lose your mouse control. In Linux I hit CTRL+ALT+F1 then CTRL+ALT+F7 to get out of X and back. This usually does the trick. But it is annoying. And since I’ve installed my synaptics driver this has happened once, and the change screen trick didn’t work, I’ve lost my mouse!

Kernel 2.6.0 I upgraded to kernel 2.6.0, everything that was working still works with 1 exception. My touch pad mouse no longer allows taps, and the scroll bar no longer scrolls. I did some brief research and found that this is an issue with 2.6.0, and I’m going to try 2.6.1 and see how it goes, I’ll report here. No updates because I’ve just been using my laptop without any problems. My Orinoco card finally gave out on me, the end is a little bent, so I threw in my 200mW card that I used to use in my DSL access point, this is the most powerful 802.11b card I’ve ever used. I 95-100% signal all over my house.

What works/doesn’t work
The things I have currently working are; sound, Xwindows (1024x768x32bpp), built in Ethernet, pcmcia Orinoco wireless LAN card, ACPI/battery status/auto power off on shutdown, USB, the touchpad with the scrollbar (reason enough to buy an HP).
I haven’t tried these things: firewire, video out, the special buttons, the built in modem.
For me there are no issues with Linux on this laptop right now that I’m working on, I’m considering trying the modem since it is a laptop and having modem access while roaming seems like a good thing. I always plan to try firewire in the near future.

Major Issues
Without a doubt the single largest issue I had was configuring and getting my sound to work. Finally, the ACPI kernel fixed it and I get sound. I wouldn’t say it’s problem free (I get occasional crackling in some sounds, not mp3′s but system sounds), but it’s very usable. You can find the ACPI kernel project here and the downloads page here. The ACPI kernel allowed me to view my battery information in /proc/…(add full path), as well as enable the laptop to power off automatically on shutdown.
The only other issue I still occasionally experience is the instant turn off, this only happens if the laptop is on a surface that doesn’t dissapate heat well. I’ve got some Duplo blocks and the laptop has never just powered off while it’s been on it’s duplo blocks. This leads me to think it’s heat related. It has run processor intensive tasks for long periods of time on the blocks with no instant power offs (such as installing gentoo).

Installing Gentoo/RedHat/Mandrake notes
Gentoo:
First a word about Gentoo. Gentoo is source based distribution. Here is their about doc. Gentoo brought to Linux what I missed from FreeBSD, a good ports system. I know Debian has had apt for a while, but I never tried it, and I plan to. For those of you who haven’t heard of ports, it’s basically an easy interface to getting new software, while maintaining dependencies and still building from source. The Gentoo ports system is great, it has most software you need. Once you’re up and running in Gentoo you simply emerge packagename to install software. The Ebuild system calculates dependencies, downloads all necessary files and builds them using your make flags. Which brings up another nice thing about Gentoo. It’s fast, anyone who has run RedHat then switched to Mandrake has seen a small sample of what processor optimizations can do for Linux. RedHat is built for i386, the lowest common denominator for processor optimizations. RedHat will run on any i386 platform. Mandrake, on the other hand, is built using i586 optimizations, and therefore requires a pentium level computer to run. Gentoo allows you to specify your own optimizations, they can be pentium4, pentium3, athlon xp, athlon, i686, i586, whatever you want. I use pentium3 for my laptop, so my entire system from the kernel to the simple commands is optimized for a pentium3 processor. I also used the flags to break compatability with other processors (I’m not planning on moving my programs from my laptop to another computer ever.) This means Gentoo is FAST. For a laptop, where speed is generally an issue, this means much more than on a desktop. But I run Gentoo on several desktop systems and it’s fast there too.
To install gentoo I did a stage 1 install, following the x86 installation documents pretty much straight through. I know many people view Gentoo as a hard core Linux, but it’s a great way to learn what’s really going on with your system. I recommend it for people who are comfortable compiling a kernel.
The first couple times I installed Gentoo on various machines I tried some new things, such as the recommended meta log, and the various cron daemons. I’m now back to syslog and vcron (old standbys), since I frequently tail -f logfiles to watchs things happen.
RedHat(7.3):
The RedHat install went very smoothly, of the standard binary distributions I’d say it’s the most recommended for the HP zt1150. I started with Linux reiserfs on the RedHat boot line so I could use Reiserfs. The only real reason I use reiser over ext3 , JFS, or XFS is I once had a server run out of inodes and reiser has 4Billion possible inodes per partition. Reiser’s home page is here if you’d like to read more about it. AFAIK XFS is the fastest file system ever, but suffers fragment limitations and inode limits like other file systems, for example if you write a 500 byte file and your inodes are 4K each, then you’ll use 4K of actual disk to store that file, as opposed to reiser where you’ll use 500 bytes. I partitioned my disks with one swap and the rest on /. I think it’s a waste to split your partitions more unless you need some other logical type seperations, like you want seperate quotas for a user’s mail and web space, which doesn’t noramlly apply on a laptop.
If you’re a newbie to Linux or would just like to run a standard binary distro then I’d recommend RedHat, and install a new kernel with the ACPI patches. I’m considering selling CD’s with my base image on it, all configured with Gentoo or RedHat. Let me know if this is something you’re interested in, and I’ll get off my duff and do it. Email me kgb (then the at sign here) submarinefund.com.
Mandrake(9.0):
Mandrake 9.0 installed smoothly, but the pcmcia didn’t work. I tried some configuration changes but couldn’t get it to work. The sound didn’t work, of course, and without pcmcia and wireless I was wasting my time. Instead of rebuilding my kernel and fixing things I decided to jump to Gentoo.

Wireless howto A real full version of a wireless howto is here
First let me say that encryption was the biggest hurdle for me using any wireless network. I view it as a must, don’t just turn it off so things will work easy. I know it can be cracked and broken, but most people won’t be able to do it, so it is somewhat of a deterrant.
Your WEP keys can be entered with the ASCII clear text version of the key, or the HEX version. There are 2 key lenghts for standard WEP, 40 bits, and 128 bits. A 40 bit WEP key is 5 ASCII characters (such as mykey), and X HEX characters (such as AABBAACCDD) (fix here fill in X and fix example). A 128 bit WEP key is 13 ASCII characters (such as thisismykey1). Windows XP is picky about the ASCII key length you enter, but Linux will just chop off extra bits.
You’ll need 3 things to use your laptop on a wireless network, 1 a driver, 2 wireless tools, and 3 your network settings. Install your driver for your wireless card.. RedHat has a nice looking howto for 8.0 here and here
Install wireless tools, available here (version 26) , home page here. Or, if you’re running Gentoo type emerge net-wireless/wireless-tools as root.
Grab the script I use to get onto my home wireless network, and modify it to meet your needs. You’ll need to change ESSIDHERE to your wireless ESSID for your router, COMPUTERNAMEHERE to your computer’s name/alias (this doesn’t matter much), and KEYHERE to you’re WEB key in ASCII. If you’re using the HEX version of you’re WEP key, delete the leading s: after key, and just put your HEX key in there. Then chnage the IP information, I’ve updated this so it should work on most default access point configurations I’ve come across. (changed the network to the normal 192.168.0.x and put it near the middle of the network at .114.
If you don’t have a WEP key for some crazy reason just delete the part ‘key s:KEYHERE’
Make sure your script is executable, and execute it as root. (chmod uog+x homenet, ./homenet)
I generally place my homenet script in root’s ~/bin/ directory and add it to my path in my .bashrc file.
You should be up and running on your wireless network, try pinging your gateway, then hit the web.

Config files
My 2.6.1 HP ZT1150 Kernel Config file
Wireless network script
Ethernet networking script
XFree86 Config file (/etc/X11/XF86Config-4)
Modules.conf file for oss sound and other gentoo generated things.. Old Modules.conf file for alsa sound and network drivers if they’re not built into kernel, this never worked for me..
My ACPI kernel (1.3MB)
My kernel modules, untar in /lib/modules/ (496K)

Links from page
Synaptics Driver
My desktop screenshot (Jan 23, 2004)
My desktop screenshot (Feb 25, 2003, 148K)
My desktop screenshot (Feb 21, 2003, 70K)
My desktop screenshot (Aug 13, 2002, 200K)
Enlightenment, my window manager of choice
RedHat inc, recommended binary distro for the zt1150
Mandrake, a good distro, better than RedHat, but didn’t work as well out of the box for me
ALSA, the Advanced Linux Sound Architecture
freshmeat’s Enlightenment themes archive
Gentoo Linux, a great source based disto of Linux
Slackware Linux
Debian Linux
Wireless HOWTO
RedHat wireless howto
RedHat 8.0 establishing a wireless connection
The Linux Documentation Project
The Linux Kernel Archives
Another HP zt1000 users page, Gentoo even!

Support gaming on linux! Sign this petition for Half-Life 2 native port..

,

No Comments

Easy AdSense by Unreal