Top wizardry
OK, you're probably way too familiar with the Linux top command. But do you know what all of these mean?
- top -b -n 1
- top -u www-data
- top -p 4365
If not, head over to this valuable article on using top more efficiently.
During my programming work I had to do some system administration tasks, and since a while I'm also maintaining some servers. This is a log for the problems I find - and hopefully their solutions.
OK, you're probably way too familiar with the Linux top command. But do you know what all of these mean?
If not, head over to this valuable article on using top more efficiently.
It's easy to just simple do a
This is probably the most common wildcard example, still, I needed some googling to find the perfect way to do it. The idea is that the setup should accept any kind of subdomains (we don't know in the beginning, what subdomains might come), and serve them from one central scritp. Of course all this without the user seeing what's going on behind the curtains. Let me make it clear with an example:
# Rewrite <subdomain>.example.com/<path> toOf course you'll have to replace example.com to your main domain, and centralscript.cgi for your script's name. Restart apache, and check if it works. If not, study the rewrite log set up above, if yes, comment out the two last lines - again, no need to overload the server with some useless logging junk.
# example.com/centralscript.cgi/<subdomain>/<path>
RewriteEngine On
# Skip rewrite if no hostname or if subdomain is www
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
# Extract (required) subdomain (%1), and
# first path element (%3),
# discard port number if present (%2) (in one line!)
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI}
^([^.]+)\.example\.com(:80)?<>/([^/]*) [NC]
# Rewrite only when subdomain not equal to
# first path element (prevents mod_rewrite recursion)
RewriteCond %1<>%3 !^(.*)<>\1$ [NC]
# Rewrite to /subdomain/path
RewriteRule ^(.*) /centralscript.cgi/%1$1 [L]
# Do some logging
RewriteLog "/var/log/apache/rewrite.log"
RewriteLogLevel 9
#!/usr/bin/perlOf course the usual blahblah applies: script should have the x flag, and ExecCGI should be allowed for the directory where it's in.
print "Content-type: text/plain\n\n";
print "CGI parameter (PATH_INFO): $ENV{'PATH_INFO'}";
Say you have more than one (we have eight, and growing...) number of MT blogs that have templates that are the same for every one of them. (For example the RSS feed, individual archive, whatever.) You'd love to have them at a central place, so when it's time to finetune, you don't have to modify all the blogs' templates for the same changes. I hate doing repetitive stuff, so instead I found out that how I can avoid it.
It's been ages since I've been looking for a solution to be able to check dead links on my sites. Just it never had a high priority - until now.
This was weird. 2 days ago my connection to a company IMAP server simply stopped working. To cut a long story short, after lots of trying and head-scratching, I could at least identify the problem at its roots: whenever I telneted to a working port of the IMAP server (it has webmail too, etc) I was faced with an empty screen, and after the first keypress, the connection dropped.
This is quite straightforward, just I need it so rarely that I'm keep on forgeting, so here's the note. The package is cksfv, to create an sfv checkfile for sample.tgz use cksfv sample.tgz > sample.sfv, to check it just use cksfv sample.svf.
I've updated the original article in case someone finds it through google. Phew.