Category Archives: Linux

Using swatch to Monitor Logfiles

A very useful tool for monitoring logfiles is Swatch (aka Simple WATCHer of Logfiles). This is a perl program that essentially watches a logfile. You can run as many instances of it as you want, but you can only watch one logfile per instance. Depending on the log file you want to watch, you may have to run swatch with some additional privilege. For instance, /var/log/messages is likely to be the primary target for anyone interested in using swatch. But this file should be readable

How to: Purge, Flush or Delete Postfix Queue, or a Single Email

How to: Purge, Flush or Delete Postfix Queue, or a Single Email

Written by 
Date: 2012-04-25 14:53:30 00:00

To flush or purge the postfix mail queue, just enter this command

postfix -f

But if you need to delete an individual email from the queue, you’ll first need to see the queue. Traditionally you use mailq this time we’ll use:

postqueue -p

And the output should show all messages in queue:

5642B4D8647* 1683500 Tue Jun  3 08:37:27  xxxxxx@xxxxxxx.com
                                         rrrrrrrrr@hotmail.com

9359B4D82B1* 1635730 Tue Jun  3 08:36:53  xxxxxx@xxxxxxx.com
                                         yyyyyyyy@hotmail.com

The first number is the message ID, if you only want to delete one of them, enter:

postsuper -d 5642B4D8647

That will only delete one email for the queue, that specific email you want to delete from it.

If you want to delete all deferred mails, you can use:

postsuper -d deferred

Source: How to: Purge, Flush or Delete Postfix Queue, or a Single Email

How to start tmux with attach if a session exists – Unix & Linux Stack Exchange

The answer is much simpler. Just put this in your ~/.tmux.conf file: # if run as “tmux attach”, create a session if one does not already exist new-session -n $HOST If you run tmux attach and there is a session, then it will attach to that session (whether it’s already attached or not). If there is not a session already then it will create one for you.

Source: How to start tmux with attach if a session exists – Unix & Linux Stack Exchange