General

Bash eternal history

export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \
"$(history 1)" >> ~/.bash_eternal_history'

source

By WladyX on 24 January, 2012 | General, Scripts | 1 comment

mount –bind /etc/fstab

/path1 /path2 bind defaults,bind 0 0

source

By WladyX on 6 January, 2012 | General | A comment?

Terminator F10 button brings up right click menu

~/.gtkrc-2.0:
binding "NoKeyboardNavigation" {
unbind "F10"
}

class “*” binding “NoKeyboardNavigation”

source1 source2

By WladyX on 5 January, 2012 | General | A comment?

Zombie processes

What is a zombie process?

When a process finishes execution, it will have an exit status to report to its parent process. Because of this last little bit of information, the process will remain in the operating system’s process table as a zombie process, indicating that it is not to be scheduled for further execution, but that it cannot be completely removed (and its process ID cannot be reused) until it has been determined that the exit status is no longer needed.

When a child exits, the parent process will receive a SIGCHLD signal to indicate that one of its children has finished executing; the parent process will typically call the wait() system call at this point. That call will provide the parent with the child’s exit status, and will cause the child to be reaped, or removed from the process table.

How do I see if there are zombie processes on a system?

Run “ps aux” and look for a Z in the STAT column.

How do I remove zombie processes from a system?

Well, first you can wait. It’s possible that the parent process is intentionally leaving the process in a zombie state to ensure that future children that it may create will not receive the same pid. Or perhaps the parent is occupied, and will reap the child process momentarily.

Secondly, you can send a SIGCHLD signal to the parent (“kill -s SIGCHLD <ppid>“). This will cause well-behaving parents to reap their zombie children.

Finally, you can kill the parent process of the zombie. At that point, all of the parent’s children will be adopted by the init process (pid 1), which periodically runs wait() to reap any zombie children.

source

By WladyX on 4 January, 2012 | General | A comment?

Sending SMS with SMPP, Kannel and Java

By WladyX on 7 October, 2011 | Cool Apps, General | A comment?

squid X-forwarded-for logs

logformat squid [%{%d/%m/%Y-%H:%M:%S}tl] %un %{X-Forwarded-For}>h through %>a %Ss/%03Hs %rm/%Hs %ru %Sh/%h

cache_access_log /var/log/squid3/access.log squid

also

By WladyX on 30 September, 2011 | General | A comment?

Installing Cygwin/X

Cygwin/X packages are located in the X11 category.

  • xorg-server (required, the Cygwin/X X Server)
  • xinit (required, scripts for starting the X server: xinit, startx, startwin (and a shortcut on the Start Menu to run it), startxdmcp.bat )
  • xorg-docs (optional, man pages)
  • X-start-menu-icons (optional, adds icons for X Clients to the Start menu)
  • You may also select any X client programs you want to use, and any fonts you would like to have available.
  • You may also want to ensure that the inetutils or openssh packages are selected if you wish to use telnet or ssh connections to run remote X clients.

source

By WladyX on 29 September, 2011 | General | A comment?

Make pg_hba.conf Changes Activate Without Restarting Postgres

su - postgres
vi /var/lib/pgsql/data/pg_hba.conf
pg_ctl reload -D /var/lib/pgsql/data/

source

By WladyX on | General | A comment?

Filter rsyslog message log

conf:

:programname, isequal, "postgres" ~
*.*;auth,authpriv.none -/var/log/syslog

source

===========

if $programname == 'dovecot' and $msg contains 'Disconnected (no auth attempts): rip=127.0.0.1, lip=127.0.0.1' then ~
if $programname == 'sudo' and $msg contains 'zabbix : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/hddtemp -n' then ~
if $programname == 'pure-ftpd' and ($msg contains '(?@127.0.0.1) [INFO] New connection from 127.0.0.1' or $msg contains '(?@127.0.0.1) [INFO] Logout.') then ~
if $programname == 'postfix' and ($msg contains 'connect from localhost[127.0.0.1]' or $msg contains 'lost connection after CONNECT from localhost[127.0.0.1]') then ~

*.*                  /var/log/everything.log

By WladyX on 22 September, 2011 | General | A comment?

Change the default sort for all Thunderbird folders, inc RSS

Edit->Preferences->Advanced->General->Config editor

change:

mailnews.default_news_sort_order 1
mailnews.default_news_sort_type 22
mailnews.default_sort_order 1
mailnews.default_sort_type 18

to:

mailnews.default_news_sort_order 2
mailnews.default_news_sort_type 22
mailnews.default_sort_order 2
mailnews.default_sort_type 18

and delete ImapMail from ~/.thunderbird/profile

source

By WladyX on 29 August, 2011 | General | A comment?