cordump.com

Author Archive

TIP: Figuring out which RPM’s contain which files

by daven on Feb.18, 2009, under General System Administration, Quick Tips

If you ever need to know what files an RPM will install or what RPM’s “own” a file on your system then the rpm command has a few switches that can help you out.
If you want to know which file’s an installed RPM’s owns:

rpm -ql

If you have an RPM file and want to know what file’s it will create or modify before you install it:

rpm -qpl

And finally if you have a file or directory and you want to know which RPM installed it:

rpm -qf

Leave a Comment more...

TIP: force sudo to forget your password

by daven on Jan.26, 2009, under General System Administration, Quick Tips

Very rarely you need to force sudo to forget your cached password or token in super secret decoder ring lingo. All you need is one little flag an you are ready to

% sudo -k

See simple

Leave a Comment more...

TIP: search and replace, in place, across multiple files

by daven on Jan.20, 2009, under Automation, General System Administration, Quick Tips

Ever have that need to change one little thing in a bunch of files? You know after you accidentally misspelled your Boss’s name as “Marvin Blowhard” on every page of the Company website.
Now you could open up each file in vi and find every reference to Mr. Blowhard to Joe Smith, even using search & replace
s/Marvin Blowhard/Joe Smith/ inside vi get’s kind of tedious after a while. That joke doesn’t seem so funny now, does it?
Now consider a little BASH and sed foo

for i in `ls *.html`; do sed "s:Marvin Blowhard:Joe Smith:g" $i >temp;mv temp $i; done

All nice and done so you can get back to planning your next BOFH moment, like sending him in the into the server room with a flash light to look for breaks in the fiber runs.

Leave a Comment more...

TIP: X forwarding after su’ing to another user

by daven on Oct.19, 2008, under General System Administration, Quick Tips

It is a fairly common occurrence now days for security purposes to disable remote login access for “role accounts” like Oracle or Mysql. This restricts you to logging as a normal user then using the su command to become the role users. It works great in almost every circumstance but what if you need access to a remote X display while su’ed to the role account? Just trying to run the X program as normal will give you an error.
So what do you do? Why you find the Magic Cookie!
Before doing su to the become the new user do

$ xauth list

You should get back a result that looks something like this

hostname.domainname.com:11 MIT-MAGIC-COOKIE-14d22408a71a55b41ccd1657d7923ae

Now that you have your Magic Cookie don’t forget to stock up on the munchies.
su to the new user and tell it what the Magic Cookie is so it can communicate with the Xserver.

su - someuser
password: *******
xauth add MIT-MAGIC-COOKIE-14d22408a71a55b41ccd1657d7923ae

Then export X programs as normal

Leave a Comment more...

Apache disk full error, with lots of free disk space

by daven on May.12, 2008, under Uncategorized

Occasionally when attempting to start or restart Apache 2.2.X you may get an error like “No space left on device: Couldn’t create accept lock” in the error logs. No a quick df shows that you have plenty of space left on all filesystems so what now…
Apache uses semaphores to control its sub processes and sometimes those semaphore’s don’t get closed properly and the error you are getting actually means Help! and can’t get anymore semaphore’s.
Now to see if this is actually the case you can check the following command:

ipcs -s | grep

If you see a lot of entries, espically if Apache does not start, then this is probably your issue. Fortunately, there is an easy way to resolve the issue, just run the command below to kill all semaphores owned by .

ipcs -s | grep | perl -e ‘while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}’

You do run everything as unique users don’t you? Other wise any other running applications or apache instances owned probably were killed and need to be restarted.

Leave a Comment more...

Vacuuming your Mail.app

by daven on Mar.11, 2008, under Quick Tips, links

Want to speed up and improve the performance of Mail.app on your Mac? Just Vacuum it up and watch it fly
http://gracefulflavor.net/2007/03/16/simple-trick-speeds-up-mailapp-considerably/

Leave a Comment more...

TIP: Are we there yet part 2, using a watch dog

by daven on Jan.22, 2008, under Automation, General System Administration, Life in General, Quick Tips

As a follow up to the previous tip on getting notified. What do you do when you have an already running process that you would like have notify you when it completes?
So you kicked off this update that was only supposed to take a few minutes but now an hour later it is still running and you are tired of having to check up on it, wouldn’t it be nice if you could just get a nice little e-mail letting you know when its done. Well, this little one liner just might make your day, ok maybe your hour…

while [ $(ps auxww | grep -i SOMEPROCESS | grep -v grep > /dev/null; echo $?) -eq 0 ]; do echo -n “.”; sleep 5; done; echo `/bin/date` | mail -s “SOMEPROCESS has completed” me@example.com

This little ditty will print a “.” every 5 seconds while the process is running, then when it completes will shoot you a nice little e-mail with the time it completed in the body. Now just don’t forget to the processes in screen so they can keep running even if you get disconnected.

1 Comment more...

TIP: Are we there yet? Having a command notify you when its done

by daven on Jan.19, 2008, under Quick Tips

Sometimes you have a long running process and rather than check up on it periodically you would just rather have it notify you. From the command line this is really simple you can have it email you using the mail command.

% ps auxww ; echo "ps done" | mail -s "ps done" me@example.com

This will just email you “ps done”, now suppose you want the output of the command do

% ps auxww | mail -s "ps done" me@example.com

this will include the the output of the command in the body of the email message

% time ps auxww | mail -s "ps done" me@example.com

and finally include the bash command time before the command you will get the exact amount of time it took to run included at the bottom of the e-mail.
By piping to mail you can get a bit of piece of mind not needing to constantly check on you process and with the right options even get the output and the exact run time.

Leave a Comment more...

MTR: traceroute that works

by daven on Jan.08, 2008, under General System Administration

mtr is an update to the classic traceroute that is able to continue giving results even if one of the hops times out. The homepage
for mtr explains it below:

As mtr starts, it investigates the network connection between the host mtr runs on and a user-specified destination host. After it determines the address of each network hop between the machines, it sends a sequence ICMP ECHO requests to each one to determine the quality of the link to each machine. As it does this, it prints running statistics about each machine.

Leave a Comment more...

TIP: using Gmail to have mutliple unique e-mail addresses

by daven on Jan.02, 2008, under Quick Tips

Have you ever wanted to have a specific e-mail address for a site or maybe a throw away address so you can see if your credit car company is the one selling your e-mail address to spammers. Now you could use your own domain name and setup multiple e-mail addresses for each account and forward them on to a central mailbox for you to peruse. However, if you have a GMail account or if you don’t mind setting one up ( it is free after all ) you can use the usename+ trick.
To use this trick simply type your e-mail address and normal but in between your username and the @ enter in + followed by something descriptive. So for example if my gmail email address was notarealemailadddress@gmail.com and I wanted a unique e-mail address for cnn.com to you I could simply give them the e-mail address notarealemailaddress+cnn@gmail.com, GMail will then happily ignore the + and everything after it and deliver the e-mail to your inbox.
Have and if you find that someone was selling your address to spammers via this method make sure to let the world know what evil bastards they are.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...