exim4 deleting a mail from the qeue

To delete one message from the exim queue

exim -Mrm message-id

To find the ids of all qued mails

mailq

If you wish to delete all the messages to a specific email recipient.

exiqgrep -i -r '<mail@example.com>' | xargs exim -Mrm

Of if you wish to delete all messages that were sent from a specific email address.

exiqgrep -i -f '<mail@example.com>' | xargs exim -Mrm

Turning off password saving (on a form)

If you have a form that you do not wish to use autocompletion for (either you want to disable password auto completion “for real”, or perhaps you have a form where the saved credentials are filled in where they shouldn’t be) then a quick tip to achieve this is to set ‘ autocomplete=”off” ‘ on the form.

<form id="loginForm" action="login.php" method="post" autocomplete="off">

Turning off VoddlerNet autostart in windows

VoddlerNet is a part of Voddler, it is used to distribute content via peer-to-peer technology in order to offload the company’s servers.
However this means that it takes up bandwidth from the users (and also makes ping drop if you play on-line games).

  1. In run (windows button+r) enter “services.msc” (or you can open Services via the control panel if you like to)
  2. Find VoddlerNet in the list of Services, choose properties and now change startup type to “Manual”

This changes the settings so that VoddlerNet don’t start automatically with windows, instead you have to start it manually (right click the VoddlerNet icon and choose start) before you start using voddler.

Magento: Invalid transactional email code: x

If you start seeing this error (both when trying to order) and as emails to the sales address then the error is most likely that someone has deleted the template with id x but that is still set to be used in the database.

The solution for this is to update “System-Configuration-Sales Emails” in admin and save existing templates instead of the template that is now removed.

Note: Also it might be good to consider why this happened, is there some (real) problem or was the template file(s) updated and some old database template was removed [perhaps there is an educational need].

What program is using port x?

netstat can be used to figure out what program is using a port.

$ netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1096/sshd
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1733/apache2
tcp6       0      0 :::22                   :::*                    LISTEN      1096/sshd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     6338     1071/gdm-simple-sla @/tmp/gdm-greeter-LvjLQPzT
unix  2      [ ACC ]     STREAM     LISTENING     5165     1072/X              /tmp/.X11-unix/X0

If you have a lot open then grep can be used to only find what you are looking for

netstat -nlp|grep :22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1096/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      1096/sshd

For windows, simply start with

netstat -n

Showing (and/or) Clearing the arp cache

The arp cache should (normally) be cleared within 20 minutes (or less, this depends on what platform is used).

If you don’t know what ARP is and what is is good for, then perhaps you should take a moment and read the man page:

DESCRIPTION
Arp manipulates or displays the kernels IPv4 network neighbor cache. It can add entries to the table, delete one or display the current content.
 
ARP stands for Address Resolution Protocol, which is used to find the media access control address of a network neighbor for a given IPv4 Address.

On a windows platform to show the arp cache

C:\> arp -a
Interface: 192.168.1.49 --- 0xb
  Internet Address      Physical Address      Type
  192.168.1.29          00-1d-92-08-49-25     dynamic
  192.168.1.34          00-24-81-85-ab-b6     dynamic

To clear the cache

C:\>netsh interface ip delete arpcache
Ok.

To show the arp cache on a nix machine:

$  arp -vn; cat /proc/net/arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.254            ether   00:08:ae:09:20:a0   C                     eth0
IP address       HW type     Flags       HW address            Mask     Device
192.168.1.254    0x1         0x2         00:08:ae:09:20:a0     *        eth0

To clear the apr cache on a nix machine.

$  ip neigh flush all

apt-get update gives the error “E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)”

If running apt-get (or aptitude) and you get the following error:

$ apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the list directory

Then (most likely) explenation is that one of the sources have gotten a timeout and that a (cron) sheduled update task have gotten locked.
A simple solution for this is to find the cron process is locked, and kill it.

$ ps -a |grep apt
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
 3737 ?        SN     0:00 /bin/sh /etc/cron.daily/apt
 3833 ?        SN     0:00 apt-get -qq -y update -o APT::Update::Auth-Failure::=cp /usr/share/apt/apt-auth-failure.note /var/lib/update-notifier/user.d/
 3835 ?        SN     0:00 /usr/lib/apt/methods/http
 3838 ?        SN     0:00 /usr/lib/apt/methods/http
 3842 ?        SN     0:00 /usr/lib/apt/methods/http
 3869 ?        SN     0:00 /usr/lib/apt/methods/http
 4223 pts/0    R+     0:00 grep apt
$ kill -9 3833

If this happens often, then perhaps you should try to debug the sources and remove (or exchange) the source that is causing the problems.

mysqldump Couldn’t execute references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

If you get an error messages like “mysqldump: Couldn’t execute ‘SHOW FIELDS FROM `store_information`’: View ‘database.viewname’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)” then a number of things might be wrong:

  • The view is “corrupted” (this could happen if the table the view is of has been updated in a way so that the view is no longer correct – for instance if the table structure is updated)
  • The user you are using are lacking permissions (to the view/table (that the view is referencing) )

What I usually do when this happens to solve it is to:

  1. Verify if the user running the mysqldump has the permissions (or test as root if you can – as root has more permissions).

    If this is the case: update the permissions on the user running the dump – or change to another user

  2. Try to find out if the table the view is referencing has been updated (think back what have I done/check with the rest of the team)
    Or if you do not wish to/can not do this, check a previous backup up the base table (from when mysqldump worked with the view) and compare the structure with the current structure in the database.
  3. If this is the case: I just drop the view and recreate the view so that it gets corrected in the underlying db structure and re-run the dump.

More info for people using this notebook as a article; here is some manual pages that will help you along if you don’t know how to alter permissions/create views.
More information about user permissions
More information about views

sudo without password

Use visudo to edit /etc/sudoers

user host = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm

user, host and or the list of commands to be run can be swapped with the keyword ALL.
However that is probably not a good idea in most cases.

more info on this is in the manpages sudoers(5)

svnadmin dump vs hotcopy

  • hotcopy makes a direct copy of the repository. It is fast, but it keeps information about the underlying file system etc. The server where the copy is imported needs to be the same version, have the same config etc.
  • dump is version independent. This means that the exported copy can be used by any version of svn.

IMHO: dump is better for backups and long term archiving (outside a repository) [like a tape in a vault].
hotcopy is better suited to make a quick copy to another server when the other server is up and running.

The base information for this post was found in the svn maillist