Archive

Archive for the ‘FreeBSD’ Category

Svc command line switches

January 3rd, 2009 No comments

  • -u: Up. If the service is not running, start it. If the service stops, restart it.
  • -d: Down. If the service is running, send it a TERM signal and then a CONT signal. After it stops, do not restart it.
  • -o: Once. If the service is not running, start it. Do not restart it if it stops.
  • -p: Pause. Send the service a STOP signal.
  • -c: Continue. Send the service a CONT signal.
  • -h: Hangup. Send the service a HUP signal.
  • -a: Alarm. Send the service an ALRM signal.
  • -i: Interrupt. Send the service an INT signal.
  • -t: Terminate. Send the service a TERM signal.
  • -k: Kill. Send the service a KILL signal.
  • -x: Exit. supervise will exit as soon as the service is down. If you use this option on a stable system, you're doing something wrong; supervise is designed to run forever.

Install check_mysql_perf on FreeBSD

December 18th, 2008 No comments

I recently had to install check_mysql_perf on our nagios server runing FreeBSD.

After a few failed attempts , I contacted the author Gerhard asking for help. Sure enough a few minutes ( !!! ) later he send me a reply back : 

Add the following at the end of the check_mysql_perf.c : 

char* strndup(const char* string, size_t n)
{
char* copy_string = 0;

if(0 == string || 0 == n)
return 0;

copy_string = (char*) malloc(n + 1);
if(0 == copy_string)
return 0;

memcpy(copy_string, string, n);
*(copy_string + n) = ‘\0′;

return copy_string;
}

and find this line ( line number 77 in my file ) :

char *mysql_status_historical (MYSQL *, char *, long *, int);

and add below it :

char *strndup(const char*, size_t);

this worked like a charm and I have a working plugin now.

thanks Gerhard !!!

Mount ISO on Linux/FreeBSD

December 4th, 2008 No comments

On Linux
mount -o loop -t iso9660 path/to/iso.iso /mnt

On FreeBSD
mdconfig -a -t vnode -f /isofile -u 0
mount -t cd9660 /dev/md0 /mnt

Qmail-tls notes

September 26th, 2008 No comments

I am using Bill Shuff's toaster patch ( thanks bill , you rule ! ) , for some reason make cert did not work. I create the certs manually :

#openssl req -newkey rsa:1024 -x509 -nodes -days 3650 -out servercert.pem -keyout servercert.pem

qmail did show TLS up but i got an error : 

#openssl s_client -debug -crlf -starttls smtp -connect localhost:25
50883:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:/usr/src/secure/lib/libssl/../../../crypto/openssl/ssl/s23_clnt.c:562:

scratching my head around the net I found this and run :

#openssl ciphers > /var/qmail/control/tlsclientciphers #openssl ciphers > /var/qmail/control/tlsserverciphers 

which fixed it all: 

#openssl s_client -crlf -starttls smtp -connect localhost:25

CONNECTED(00000003)

FreeBSD, Thinkpad X40, Intel 2200BG and WPA

September 5th, 2008 No comments

I have the intel 2200bg wirelss card and used the iwi-firmware .

Load modules at boot :

vi /boot/loader.conf
if_iwi_load=”YES”
wlan_load=”YES”
firmware_load=”YES”
legal.intel_iwi.license_ack=1

configure iwi network options :

vi /etc/rc.conf
ifconfig_iwi0=”WPA DHCP”

configure WPA settings :

vi /etc/wpa_supplicant.conf
ctrl_interface_group=0
network={
ssid=”ssid”
key_mgmt=WPA-PSK
psk=”shared-key”
}