Friday, February 29, 2008

wordpress upgrade - four simple steps

Recently I was forced to upgrade my wordpress and in the past having not had the patience to read the documentation, my attempts were not very successful.

So, it was good to have found a good source which described the process in four simple steps using the shell. It worked.

Step 1: Backup the existing database.
I would not want to lose my work, specially the blog, so against my natural tendency, I did backup.

[me@mywebserver]# mysqldump -u lazyinvestor -p > backup_`data +%m-%d-%y`

Step 2: Get the latest wordpress .zip and unzip

This would generally work, but you should be smart enough to know there are other ways.

[me@mywebserver]# wget http://wordpress.org/latest.zip
[me@mywebserver]# unzip latest.zip

Step 3: Overwrite all the new files onto your old ones

[me@mywebserver]# cd [to_whereever_your_wordpress_files_are]
[me@mywebserver]# cp -avr [from_the_unziped_latest.zip]


Step 4: Open http://yourblog_url/wp-admin/upgrade.php in your favorite browser.

Done!

brainstorm Ubuntu

There is probably is a clever marketing-theory terminology to refer to this, but some of the best feedback for any kind of product comes from people who use it.....a lot.

Check out http://brainstorm.ubuntu.com

The best part is you get to submit your ideas and also vote on what is of more importance to you.

Power management and suspend/hibernate enhancements obviously are high up on the list. That is all good for making Ubuntu better for laptops. Even though I am very a happy with how things run on my laptop, some things like efficient power-management enhancements and faster booting will be great additions.

Tuesday, February 26, 2008

TCP optimizations and sysctl

Time and again, I have needed to tweak a server running a variety of TCP/IP application(s) so that it shows some improvement with some simple steps. I am not a System Administrator, so the quickest trick for me is to tweak simple TCP characteristics:

a) Increase TCP window size
net.ipv4.tcp_window_scaling=1
b) Enable TCP SYN cookies. This prevents SYN floods on incoming connections
net.ipv4.tcp_syncookies=1
c) Increase TCP send and receive buffers
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

All these are edits to /etc/sysctl.conf which is a configuration file to configure/edit kernel parameters at runtime.

Do
#sysctl -p /etc/sysctl.conf
to enable your changes, and
#sysctl -a
to see what else has been configured.

Monday, February 25, 2008

hup hup and away

I have used other ways to do this, and never really thought about this until somebody recently asked me how to run a command so that it continues to run even after you exit the terminal/logout.

Since I have been working with systems software development, the first thing that comes to my mind would be to make your executable a service and use the 'service [program] start/stop/restart' commands to control it.
The other option is to use a tool called 'screen' which I did try it for a few months, but never got comfortable with the scrolling up/down.

The simpler (and probably more obvious) way is to execute the program such that it is immune to hangups i.e. the 'nohup' command.

example:
nohup ./keep_this_running

This will dump the output to a file called nohup.out.

To get more control over the output, try this:
nohup ./keep_this_running 1>output.log 2>error.log

be nice

In my previous post, I gave an example command to create an (uncompressed) ISO image from a CD/DVD. The actual command was preceded by 'nice -n +19'.

Briefly, a little bit about this 'nice' command since even though I don't use it very often, it can be a very useful tool, specially on laptops like mine where I am anyways struggling for processor resources.

So, 'nice' is a command for POSIX-complaint OS'es using which you can control the priority of a process with -20 being the highest value and +19 being the lowest priority. The default value is 0, which is inherited from its parent (shell being the most likely parent).

Obviously, a lot depends on how the scheduler is designed, where the 'nice' value is probably just a part of a complicated set of parameters used to determine which task should be run next. But, it does give you a user-level control, specially when doing non-priority tasks like creating ISO copies, etc.


Wednesday, February 20, 2008

and no DVDShrink

In the previous post, I talked about using DVDShrink to save .iso from DVDs onto your laptop so that you can play movies in your favorite DVD player just like you would with regular DVDs.

What I did not mention was that, IF unlike me you are not looking to _shrink_ the original DVD and are fine with your ISO using (almost for all feature DVDs) 8GB of your precious disk space, there is an easier way:
rutul@rutul-laptop: nice -n +19 mkisofs -dvd-video -V BILL_MAHER_IM_SWISS -o /media/sda1/BILL_MAHER_IM_SWISS.iso /media/cdrom > /dev/null 2> /var/log/mkisofserrors.log

But, if you ever (don't do it, it's probably illegal) want to make a DVD out of that .iso, you will need a dual-layer DVD burner and an appropriate disk.

dvdshrink

I wanted to write a little about Automatix before I got into details about how useful the packages installed using it have been. But life doesn't pan out as one plans.....I have been realizing that lately. Anyways, more about Automatix some other time. Just know that if you use Ubuntu as your primary OS, you will appreciate having that package manager along with the obviously awesome Synaptic Package Manager.

I sometimes don't get enough time to watch a movie that I have picked up from the library, and they don't allow renewals. So, I tend to keep a soft copy of the DVD onto my laptop in ISO format, so that I can play it later. This is great if you travel a lot and like to watch movies in flight.

Step 1: Get DVDShrink (trust me, just use Automatix)

Step 2: Configure it so that you "Create ISO file only" (very intuitive to select this).
Specify where you want to create the .iso (directory).
Specify you want to remove temporary files when done.
Start

Step 3: Once you have your .iso at the appropriate location, mount the .iso
sudo mkdir -p /media/movie
sudo mount -o loop BILL_MAHER_IM_SWISS.iso /media/movie/

Step 4: Play the .iso
totem /media/movie
or
xine /media/movie (trust me, get Automatix)

Easy enough and convenient enough.