Archive for the ‘Command Line Tricks’ Category.

WordPress wp-cron not working?

There are various reasons why wp-cron does not work, one of the most common ones being a misconfigured network or firewall.

However, due to the way wp-cron works, anything that prevents WordPress opening a http connection to itself will cause wp-cron to fail. In my case I had a .htaccess password set on the development site to prevent crawlers from indexing it.

A quick test to see if WordPress will be able to access wp-cron.php is to use wget from the command line of your server:

1
wget http://www.example.com/

If this fails you will at least have a clue as to why it failed. It would be great if WordPress could log the failure rather than remaining silent (even with WP_DEBUG enabled). This was discussed in http://core.trac.wordpress.org/ticket/11831.

Forcing Linux To Shutdown Or Reboot

shutdown -r NOW
halt
reboot

not working for you?

To force a shutdown:

echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

And for a reboot:

echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger


Thanks to Nasser Heidari for the tip.

Using Runas to Add/Remove Programs/Hardware in Windows XP

Very useful if you run as a ‘restricted user’ (i.e. not a ‘power user’ or ‘administrator’):

Step 1: Get a CMD shell (‘DOS box’) as Administrator:

runas /user:administrator cmd


Continue reading ‘Using Runas to Add/Remove Programs/Hardware in Windows XP’ »

Migrating IMAP Email The Easy Way

email-iconMoving email servers has always been a royal pain for me. I’ve tried many of them over the years, and migrated from nearly as many of them. However the last couple of times I put myself through the pain I came across imapsync – an excellent script that will do an IMAP to IMAP migration across the wire.

Imapsync uses standard IMAP commands throughout, so is ideal for migrating from one brand of email server to another. (Of course there are still buggy IMAP servers out there, but well behaved ones will work fine.) It will transfer emails, folders, maintain message flags and folder subscriptions.

For best performance use the script on your new server (presumably it is much more powerful that the one you are migrating from) and make sure any obnoxiously large emails, junk, trash and other unwanted mail has been deleted (and expunged) first (see
Debug your IMAP server with Telnet for help with this.

Imapsync is written in Perl and is happy on almost any Operating System (yes even Windows!)

Debug your IMAP server with Telnet

terminalEmail by IMAP rocks – there are so many benefits to using it over POP3, particularly in an office environment. However many IMAP clients really suck when it comes to manipulating accounts with large messages. We recently watched a server brought to it’s knees during a email server migration – by an 165MB email containing wedding pictures that someone had decided to forward throughout the network!

At that stage you are better off talking directly to your email server with Telnet.
Continue reading ‘Debug your IMAP server with Telnet’ »