Sed to remove first or last character in a string.

To remove the first character in a string:
echo $STRING |sed ‘s/.\(.*\)/\1/’

To remove the last character in a string:
echo $STRING | sed ‘s/\(.*\)./\1/’

To remove the last five characters in a string:
echo $STRING | sed ‘s/\(.*\)…../\1/’

To remove all whitespace at the end of the line:
echo $STRING | sed ‘s/[ ]*$//’

Using hping to send a upd ping.

hping2 –udp -p portnumber ipaddress -d packetbodysize

Example:
I used the following to verify a DNS listening.

hping2 –udp -p 53 192.168.0.1 -d 50

Linux as print server for Tru64.

I used the following configuration to use a CentOS 5.3 server as a print server for Tru64. Note: I used this solution for testing purposes, because some Tru64 print jobs were stopping in the middle of the job, when the job was sent directly to the printer.

On the CentOS server, I had a printer set up and working via CUPS. I started cups-lpd by using ntsysv and service xinetd reload.

On the Tru64, I created an /etc/printcap entry similar to the following:

printname:\
:lf=/usr/adm/printernameerr:\
:lp=:\
:rm=remoteprinterserver:\
:rp=remoteprintername:\
:sh:\
:sd=/usr/spool/remote/printername:

Example:
myprinter:\
:lf=/usr/adm/myprintererr:\
:lp=:\
:rm=mylinuxprintserver:\
:rp=mylinuxprinter:\
:sh:\
:sd=/usr/spool/remote/myprinter:

New look

This week I decided to tackle changing the look to the site. Basically, I am still using the Connections theme developed by vanillamist. I just decided to make it my own. I am not quite done, but so far I like it. Maybe someday, I will try create my own. I just very rarely have time for something that would require that much time, especially, with my lack of strong php and graphics skills.

Bash: Input from multiple files.

exec 3<$1 4<$2

while read file1 <&3 && read file2 <&4
do
code
done

Rsyslog: remote logging

On the client you want to log from:
vi /etc/rsyslog.conf

*.* @RemoteSyslogIPAddress:Port

Example:
*.* @172.18.1.50:514

On the remote logging server:
vi /etc/rsyslog.conf

# Begin – Allow remote logging
$ModLoad imudp.so
$UDPServerRun 514
# End – Allow remote logging

Need to send a HUP to the rsyslogd process or

service rsyslog reload

Protected: MacOSX: Connecting to a Cisco router/switch.

This content is password protected. To view it please enter your password below:

Usefull lsof options

Various useful lsof options:

To view files open by a particular PID:
lsof -p pidnumber

To show processes and the port they are running on. This is a great command to find out not only process and port, but also the command and the PID.:
lsof -i -nP # The -n does not resolve the IP addresses and ports to names.

Source: http://sial.org/howto/debug/unix/lsof/

Windows Terminal License unavailable

Sometimes you can get an out of Terminal licenses message when connecting from a client, even if there are still plenty of licenses available. This can be due to some corruption in the client registry. You just need to delete the following key, and try connecting again. You should get the same license from the Terminal server.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing\Store\LICENSE000\ClientLicense

Postfix max message and mailbox size settings.

To check the current settings for postifx:

postconf mailbox_size_limit
The default mailbox size is 51200000.

postconf message_size_limit
The default message size is 10240000.

To change it:

vi /etc/postfix/main.cf

mailbox_size_limit = newmailboxsize
message_size_limit = newmessagesize

Restart postfix

Return top

INFORMATION