Wednesday, March 15, 2006

skiing in de uitholf

this is me 1st time skiing in de iutholf.
at first, it was very hard to get it balance & i fell down most of the time :P


but at last managed to get it right... it was really fun & cold of course!

hmmm maybe i'll try snowboard next time, look far more cool than ski. but they said snowboard much more harder to learn than ski... hmmm i guess i have to give it a try then :)

unix tip: sendmail - email not been sent out but queued

ever come accross with this problem? when you try to sent out email, the email can't be sent out but get queued instead!!!
# cat filename | /usr/sbin/sendmail -v yourname@domain.com
yourname@domain.com... queued

somehow, sendmail by default will check the system load average
before sent out the email. if the load average exceeds QueueLA (default 8),
it stops delivering the mail, if load average exceeds RefuseLA (default 12)
it stops accepting the mail. both of the settings are located in sendmail.cf

even you increased the value, sendmail still not works as its will give an error below.
# ps auxw | grep sendmail
root 6519 0.0 0.0 6252 2040 ? S 12:52 0:00 sendmail: rejecting connections on daemon MTA: load average: 77
Read more...

so you need to set the value higher, but i'm not so sure about this.
this is my system load average: quite high huh!!!
# uptime
3:01pm up 96 days, 23:09, 15 users, load average: 78.10, 77.86, 77.57

of course you can manually flush/sent out the emails from the queue by using command below:
# /usr/sbin/sendmail -OQueueLA=80 -q 0 -v

but in this case i suggest you take a look at your system load & if possible try to decrease the load.

it took me a few days to find out this thing since there was no error message about the load average, but if you're lucky you'll get this "sendmail: rejecting connections on daemon MTA: load average:" in your log files which make easier to google :)

update:
QueueLA default values is (8 * numproc) where numproc is the number of processors online (if that can be determined).
http://www.sendmail.org/m4/tweaking_config.html

Tuesday, March 07, 2006

unix tip: file test operators

i always keep forgetting these file test operators, so i decided to paste it here for my future reference :)
-r file check if file is readable.
-w file check if file is writable.
-x file check if we have execute access to file.
-f file check if file is an ordinary file (as opposed to a
directory, a device special file, etc.)
-s file check if file has size greater than 0.
-d file check if file is a directory.
-e file check if file exists. Is true even if file is a
directory.

example:
if [ -s file ]
then
such and such
fi

for more info, go here http://www.tldp.org/LDP/abs/html/fto.html

Friday, March 03, 2006

unix tip: ksh hotkeys vs bash hotkeys

a few of our servers are running ksh shell instead of bash. sometimes i have
problems handling ksh hotkeys because getting used to bash hotkeys like below:

bash hotkeys:
ctrl-l -- clear screen
ctrl-r -- does a search in the previously given commands so that
you dont have to repeat long command.
ctrl-u -- clears the typing before the hotkey.
ctrl-a -- takes you to the begining of the command you are
currently typing.
ctrl-e -- takes you to the end of the command you are currently
typing in.
esc-b -- takes you back by one word while typing a command.
ctrl-c -- kills the current command or process.
ctrl-d -- kills the shell.
ctrl-h -- deletes one letter at a time from the command you are
typing in.
ctrl-z -- puts the currently running process in background, the
process can be brought back to run state by using fg
command.
esc-p -- like ctrl-r lets you search through the previously
given commands.
esc-. -- gives the last command you typed.
tab -- auto completion
Read more...

below are the hotkeys when i'm using ksh shell (you have to
set -o vi first)

ksh hotkeys:
esc-\ -- auto completion. only work if the file/command is in
current directory
esc-k -- scroll up
esc-j -- scroll down
esc-/ -- search in the previously given commands (esc-/ keyin
the command you want search & enter. press n or N to
go to the next or previous command, even ctrl-r in bash
can't go to the next or previous command or maybe i just
don't know how.
esc-= -- filename check - this is cool!!!


since its using vi mode, you can also edit the commands
using below keys
esc-l -- forward one character
esc-h -- backward one character
esc-x -- delete one character
esc-r -- replace one character
esc-e -- forward end of word
esc-b -- backward beginning of word
esc-d -- delete to end of line
esc-i -- insert text (current space)
esc-a -- insert text (adjacent space)
esc-^ -- move cursor to beginning of line
esc-$ -- move cursor to end of line

note:
esc key is not necessary if you are currently in command-mode

Thursday, March 02, 2006

unix tip: wildcard - asterix (*) vs question mark (?)

ever wonder what is the different between asterix (*) and question mark (?) when you use them as wildcard?
here are some examples:

list all the files
$ ls
fileA fileAA fileAAA fileB fileBB fileBBB fileC fileCC fileCCC

if you use * it will listed all files
$ ls *
fileA fileAA fileAAA fileB fileBB fileBBB fileC fileCC fileCCC
Read more...

but if using ? it will not
$ ls ?
ls: ?: No such file or directory

list all files that start with file
$ ls file*
fileA fileAA fileAAA fileB fileBB fileBBB fileC fileCC fileCCC

but if you use 1 ? it will listed only files that start with file+1 character
$ ls file?
fileA fileB fileC

same goes when you using 2 or 3 ?
$ ls file??
fileAA fileBB fileCC
$ ls file???
fileAAA fileBBB fileCCC

conclusion:
the asterix (*) is to replace zero to multiple characters while the question mark (?) only to replace a single character & of course you can use them with other commands as well such as find, grep etc...