Tuesday, November 3, 2009

Hackintosh

It seems like, the if not even more rogue "group of hackintosh" might hit a stumbling block:

http://osxdaily.com/2009/10/31/hackintosh-netbook-users-take-note-snow-leopard-10-6-2-update-kills-support-for-atom-processor/

which let me make something clear - QUIT SHOOTING YOURSELF IN THE FOOT APPLE!

I mean do we all really have to pay for your overpriced laptops with sub-par parts. What is so hard about being a bit more like linux? Why not extend a development branch to arm/mips-el/amd - kernel drives and kernel building kit would be a appreciated. Why not have broader hardware support like the BSD's/Linux? ffs make a modular Kernel with autodetect and activate driver support! your a multi million if not billion company - challenge yourself!

-Dont charge 1800$ for a 30" monitor thats CRAP! they are much cheaper online for the same or better parts.
-Dont charge 900$ for a 24" monitor - where I have found one for 250$ that is comparable if not better.

ARE YOU FUCKING KIDDING ME IM PAYING ALMOST 3x more for a stupid logo?? REALLY?! Your no better then micro-shaft with there bloatware OS! Im mean really what would hurt if you took a page from some of the Community maintained OS's out there?

- Better support
- More Architectures
- More Driver choices
- Reasonable if not competitive with retail prices
- Commission based OS application development

I once heard a Microsoft sales guy say something very,very true as much as I hated hearing it, it had a ring of truth:

"You meet many pure Linux and Windows developers, but when was the last time you ever met a pure Mac developer?"

In truth I've never met a "Mac only developer" in fact i've met very few Linux developers that will even touch MAC's and the few that do develop there software for MAC's none of them do any such "Hardware/firmware" level development.

I can see it your way though too -a high level of "working" products with "quality" but what makes you any better or different from Microsoft. I have yet to see a difference.

MIT Open Courseware

Apparently "open" course guidelines and such for structured classes from MIT and a few other one off online schools.

http://www.onlinecourses.org/2009/10/28/100-incredible-open-courses-for-the-ultimate-tech-geek/

So far i've actually worked through the beginners Python class. Its not bad.

Tuesday, October 13, 2009

[ Linux ] maint2.sh

Kind of a Key service restart if put on a cron or scron

#!/bin/sh
# This script is meant to restart key services on a vps or server.
# Written by L.C. Version 2.0

logz=/var/log/maint_sh.log

pstree | grep ssh >/dev/null; if [ $? -eq 1 ]
then
{
/etc/init.d/`ls /etc/init.d/ | grep ss*` restart
echo "MAINT.SH: SSH restarted: `date`" >>$logz
}
fi
pstree | grep mysql >/dev/null; if [ $? -eq 1 ]
then
{
/etc/init.d/`ls /etc/init.d/ | grep mysql` restart
echo "MAINT.SH: MySQL restarted: `date`" >>$logz
}
fi
pstree | grep master >/dev/null; if [ $? -eq 1 ]
then
{
/etc/init.d/`ls /etc/init.d/ | grep postfix` restart
echo "MAINT.SH: POSTFIX restarted: `date`" >>$logz
}
fi

[ Linux ] Postfix Log Analyzer for dead addresses

#!/bin/bash
# This system filters the current maillog or mail.log and provides data on what email addresses are bad!

logs=`for logfile in /var/log/mail{.,}log; do if [ -f $logfile ]; then echo $logfile; fi; done` && echo $logs
add_log=/root/bounces.txt
rec_log=/root/bounce_record.log

if date | grep Sat | grep "21:1" >/dev/null;
then
{
gunzip mail.log.*.gz

echo "Starting : `date`" >> $rec_log

egrep -i '(Not\ a\ valid\ mailbox|User\ is\ unknown|Undeliverable\ address|recipient\ rejected|user\ unknown|invalid\ recipient\:|address\ rejected|Does\ not\ exist|Illegal\ alias|mailbox|Mailbox\ is\ inactive|reach\ is\ disabled|Mailbox\ disabled )' $logs | egrep -v -i '(policy|spam|grey?list|sender|dns|spf\ record|reverse|quota|acces\ denied|unavail|later|try|headach|temporar|full|too\ many|root|esozm)' | grep "@" | awk '{print $7}' | grep -v "host" >$add_log
   
echo " Tabulating amount of records: " >> $rec_log

egrep -i '(Not\ a\ valid\ mailbox|User\ is\ unknown|Undeliverable\ address|recipient\ rejected|user\ unknown|invalid\ recipient\:|address\ rejected|Does\ not\ exist|Illegal\ alias|mailbox|Mailbox\ is\ inactive|reach\ is\ disabled|Mailbox\ disabled )' $logs | egrep -v -i '(policy|spam|grey?list|sender|dns|spf\ record|reverse|quota|acces\ denied|unavail|later|try|headach|temporar|full|too\ many|root|esozm)' | grep -c "@" >>$rec_log

echo "Finishing : `date`" >> $rec_log
echo "dun dun dun done"

}
else
{
echo "Not time to process the mail logs"
}
fi

[ Linux ] x_hk.sh

This script came via the neccesity to abolish services that would result in a reboot/cpanel/panels that inject restart commands onto vps's. As you see it could run alot everyday if something was making it run every 5 minutes like scron.

## x_hk.sh (x-hunter-kill script) ##

#!/bin/bash
# Killer script
# x_hk.sh - includes date.

if date | grep "1:1" >/dev/null;
then
{
echo "### Running the [HK] process on this cycle ###"
echo " "
echo "## clearing the crontab ##"
crontab -r
echo "## trying to kill: httpd ##"
pgrep httpd | xargs -r kill -9
echo "## trying to kill: apache2 ##"
pgrep apache2 | xargs -r kill -9
echo "## trying to kill: xinetd ##"
pgrep xinetd | xargs -r kill -9
echo "## trying to kill: named ##"
pgrep named | xargs -r kill -9
}
else
{
echo "### Not running the [HK] process on this cycle ###"
echo "Current Time: `date`"
echo " "
}
fi

Friday, October 2, 2009

[ Centos ] Postfix dsn status script

Centos postfix DSN translation script - tells you what your mail is doing. In case you have no clue what we are chatting about view your maillog/mail.log :

Oct 1 00:35:01 ghosting postfix/smtp[1437]: ABA987666094: to=, relay=gmail-smtp-in.l.google.com[209.85.222.73]:25, delay=9881, delays=9880/0.01/0.22/0.71, dsn=2.0.0, status=sent (250 2.0.0 OK 1254342900 5si70217753pzk.88)

This largely tells you what has been done with your mail when the "status=xxxxxx" line or the message of why your mail fails is "vague".

file: centos_postfix_dsn_translator.sh

#!/bin/bash
##########################################
# Postfix DSN Script Based off of rfc3463
# http://www.faqs.org/rfcs/rfc3463.html
# Written by L.C.
# DSN rfc's refer to rfc3461-rfc3464
##########################################

######################################################
# Persistent Transient Failure Aka Deferred 4.xxx.xxx
######################################################

# Other or Undefined Status #
echo "Deferred :: 4.0.0 :: Other Undefined Status :"`cat /var/log/maillog | grep -c "dsn=4.0.0"`
echo " "
# Address Status #
echo "Deferred :: 4.1.0 :: Other address status :"`cat /var/log/maillog | grep -c "dsn=4.1.0"`
echo "Deferred :: 4.1.1 :: Bad destination mailbox address :"`cat /var/log/maillog | grep -c "dsn=4.1.1"`
echo "Deferred :: 4.1.2 :: Bad destination system address :"`cat /var/log/maillog | grep -c "dsn=4.1.2"`
echo "Deferred :: 4.1.3 :: Bad destination mailbox address syntax :"`cat /var/log/maillog | grep -c "dsn=4.1.3"`
echo "Deferred :: 4.1.4 :: Destination mailbox address ambiguous :"`cat /var/log/maillog | grep -c "dsn=4.1.4"`
echo "Deferred :: 4.1.5 :: Destination mailbox address valid :"`cat /var/log/maillog | grep -c "dsn=4.1.5"`
echo "Deferred :: 4.1.6 :: Mailbox has moved :"`cat /var/log/maillog | grep -c "dsn=4.1.6"`
echo "Deferred :: 4.1.7 :: Bad sender's mailbox address syntax :"`cat /var/log/maillog | grep -c "dsn=4.1.7"`
echo "Deferred :: 4.1.8 :: Bad sender's system address :"`cat /var/log/maillog | grep -c "dsn=4.1.8"`
echo " "
# Mailbox Status #
echo "Deferred :: 4.2.0 :: Other or undefined mailbox status :"`cat /var/log/maillog | grep -c "dsn=4.2.0"`
echo "Deferred :: 4.2.1 :: Mailbox disabled, not accepting messages :"`cat /var/log/maillog | grep -c "dsn=4.2.1"`
echo "Deferred :: 4.2.2 :: Mailbox full :"`cat /var/log/maillog | grep -c "dsn=4.2.2"`
echo "Deferred :: 4.2.3 :: Message length exceeds administrative limit :"`cat /var/log/maillog | grep -c "dsn=4.2.3"`
echo "Deferred :: 4.2.4 :: Mailing list expansion problem :"`cat /var/log/maillog | grep -c "dsn=4.2.4"`
echo " "
# Mail system status #
echo "Deferred :: 4.3.0 :: Other or undefined mail system status :"`cat /var/log/maillog | grep -c "dsn=4.3.0"`
echo "Deferred :: 4.3.1 :: Mail system full :"`cat /var/log/maillog | grep -c "dsn=4.3.1"`
echo "Deferred :: 4.3.2 :: System not accepting network messages :"`cat /var/log/maillog | grep -c "dsn=4.3.2"`
echo "Deferred :: 4.3.3 :: System not capable of selected features :"`cat /var/log/maillog | grep -c "dsn=4.3.3"`
echo "Deferred :: 4.3.4 :: Message too big for system :"`cat /var/log/maillog | grep -c "dsn=4.3.4"`
echo " "
# Network and Routing Status #
echo "Deferred :: 4.4.0 :: Other or undefined network or routing status :"`cat /var/log/maillog | grep -c "dsn=4.4.0"`
echo "Deferred :: 4.4.1 :: No answer from host :"`cat /var/log/maillog | grep -c "dsn=4.4.1"`
echo "Deferred :: 4.4.2 :: Bad connection :"`cat /var/log/maillog | grep -c "dsn=4.4.2"`
echo "Deferred :: 4.4.3 :: Routing server failure :"`cat /var/log/maillog | grep -c "dsn=4.4.3"`
echo "Deferred :: 4.4.4 :: Unable to route :"`cat /var/log/maillog | grep -c "dsn=4.4.4"`
echo "Deferred :: 4.4.5 :: Network congestion :"`cat /var/log/maillog | grep -c "dsn=4.4.5"`
echo "Deferred :: 4.4.6 :: Routing loop detected :"`cat /var/log/maillog | grep -c "dsn=4.4.6"`
echo "Deferred :: 4.4.7 :: Delivery time expired :"`cat /var/log/maillog | grep -c "dsn=4.4.7"`
echo " "
# Mail Delivery Protocol Status #
echo "Deferred :: 4.5.0 :: Other or undefined protocol status :"`cat /var/log/maillog | grep -c "dsn=4.5.0"`
echo "Deferred :: 4.5.1 :: Invalid command :"`cat /var/log/maillog | grep -c "dsn=4.5.1"`
echo "Deferred :: 4.5.2 :: Syntax error :"`cat /var/log/maillog | grep -c "dsn=4.5.2"`
echo "Deferred :: 4.5.3 :: Too many recipients :"`cat /var/log/maillog | grep -c "dsn=4.5.3"`
echo "Deferred :: 4.5.4 :: Invalid command arguments :"`cat /var/log/maillog | grep -c "dsn=4.5.4"`
echo "Deferred :: 4.5.5 :: Wrong protocol version :"`cat /var/log/maillog | grep -c "dsn=4.5.5"`
echo " "
# Message Content or Message Media Status #
echo "Deferred :: 4.6.0 :: Other or undefined media error :"`cat /var/log/maillog | grep -c "dsn=4.6.0"`
echo "Deferred :: 4.6.1 :: Media not supported :"`cat /var/log/maillog | grep -c "dsn=4.6.1"`
echo "Deferred :: 4.6.2 :: Conversion required and prohibited :"`cat /var/log/maillog | grep -c "dsn=4.6.2"`
echo "Deferred :: 4.6.3 :: Conversion required but not supported :"`cat /var/log/maillog | grep -c "dsn=4.6.3"`
echo "Deferred :: 4.6.4 :: Conversion with loss performed :"`cat /var/log/maillog | grep -c "dsn=4.6.4"`
echo "Deferred :: 4.6.5 :: Conversion failed :"`cat /var/log/maillog | grep -c "dsn=4.6.5"`
echo " "
# Security or Policy Status #
echo "Deferred :: 4.7.0 :: Other or undefined security status :"`cat /var/log/maillog | grep -c "dsn=4.7.0"`
echo "Deferred :: 4.7.1 :: Delivery not authorized, message refused :"`cat /var/log/maillog | grep -c "dsn=4.7.1"`
echo "Deferred :: 4.7.2 :: Mailing list expansion prohibited :"`cat /var/log/maillog | grep -c "dsn=4.7.2"`
echo "Deferred :: 4.7.3 :: Security conversion required but not possible :"`cat /var/log/maillog | grep -c "dsn=4.7.3"`
echo "Deferred :: 4.7.4 :: Security features not supported :"`cat /var/log/maillog | grep -c "dsn=4.7.4"`
echo "Deferred :: 4.7.5 :: Cryptographic failure :"`cat /var/log/maillog | grep -c "dsn=4.7.5"`
echo "Deferred :: 4.7.6 :: Cryptographic algorithm not supported :"`cat /var/log/maillog | grep -c "dsn=4.7.6"`
echo "Deferred :: 4.7.7 :: Message integrity failure :"`cat /var/log/maillog | grep -c "dsn=4.7.7"`
echo " "
############################################
# Permanent Failure's Aka Bounces 5.xxx.xxx
############################################

# Other or Undefined Status #
echo "Bounced :: 5.0.0 :: Other Undefined Status :"`cat /var/log/maillog | grep -c "dsn=5.0.0"`
echo " "
# Address Status #
echo "Bounced :: 5.1.0 :: Other address status :"`cat /var/log/maillog | grep -c "dsn=5.1.0"`
echo "Bounced :: 5.1.1 :: Bad destination mailbox address :"`cat /var/log/maillog | grep -c "dsn=5.1.1"`
echo "Bounced :: 5.1.2 :: Bad destination system address :"`cat /var/log/maillog | grep -c "dsn=5.1.2"`
echo "Bounced :: 5.1.3 :: Bad destination mailbox address syntax :"`cat /var/log/maillog | grep -c "dsn=5.1.3"`
echo "Bounced :: 5.1.4 :: Destination mailbox address ambiguous :"`cat /var/log/maillog | grep -c "dsn=5.1.4"`
echo "Bounced :: 5.1.5 :: Destination mailbox address valid :"`cat /var/log/maillog | grep -c "dsn=5.1.5"`
echo "Bounced :: 5.1.6 :: Mailbox has moved :"`cat /var/log/maillog | grep -c "dsn=5.1.6"`
echo "Bounced :: 5.1.7 :: Bad sender's mailbox address syntax :"`cat /var/log/maillog | grep -c "dsn=5.1.7"`
echo "Bounced :: 5.1.8 :: Bad sender's system address :"`cat /var/log/maillog | grep -c "dsn=5.1.8"`
echo " "
# Mailbox Status #
echo "Bounced :: 5.2.0 :: Other or undefined mailbox status :"`cat /var/log/maillog | grep -c "dsn=5.2.0"`
echo "Bounced :: 5.2.1 :: Mailbox disabled, not accepting messages :"`cat /var/log/maillog | grep -c "dsn=5.2.1"`
echo "Bounced :: 5.2.2 :: Mailbox full :"`cat /var/log/maillog | grep -c "dsn=5.2.2"`
echo "Bounced :: 5.2.3 :: Message length exceeds administrative limit :"`cat /var/log/maillog | grep -c "dsn=5.2.3"`
echo "Bounced :: 5.2.4 :: Mailing list expansion problem :"`cat /var/log/maillog | grep -c "dsn=5.2.4"`
echo " "
# Mail system status #
echo "Bounced :: 5.3.0 :: Other or undefined mail system status :"`cat /var/log/maillog | grep -c "dsn=5.3.0"`
echo "Bounced :: 5.3.1 :: Mail system full :"`cat /var/log/maillog | grep -c "dsn=5.3.1"`
echo "Bounced :: 5.3.2 :: System not accepting network messages :"`cat /var/log/maillog | grep -c "dsn=5.3.2"`
echo "Bounced :: 5.3.3 :: System not capable of selected features :"`cat /var/log/maillog | grep -c "dsn=5.3.3"`
echo "Bounced :: 5.3.4 :: Message too big for system :"`cat /var/log/maillog | grep -c "dsn=5.3.4"`
echo " "
# Network and Routing Status #
echo "Bounced :: 5.4.0 :: Other or undefined network or routing statu :"`cat /var/log/maillog | grep -c "dsn=5.4.0"`
echo "Bounced :: 5.4.1 :: No answer from host :"`cat /var/log/maillog | grep -c "dsn=5.4.1"`
echo "Bounced :: 5.4.2 :: Bad connection :"`cat /var/log/maillog | grep -c "dsn=5.4.2"`
echo "Bounced :: 5.4.3 :: Routing server failure :"`cat /var/log/maillog | grep -c "dsn=5.4.3"`
echo "Bounced :: 5.4.4 :: Unable to route :"`cat /var/log/maillog | grep -c "dsn=5.4.4"`
echo "Bounced :: 5.4.5 :: Network congestion :"`cat /var/log/maillog | grep -c "dsn=5.4.5"`
echo "Bounced :: 5.4.6 :: Routing loop detected :"`cat /var/log/maillog | grep -c "dsn=5.4.6"`
echo "Bounced :: 5.4.7 :: Delivery time expired :"`cat /var/log/maillog | grep -c "dsn=5.4.7"`
echo " "
# Mail Delivery Protocol Status #
echo "Bounced :: 5.5.0 :: Other or undefined protocol status :"`cat /var/log/maillog | grep -c "dsn=5.5.0"`
echo "Bounced :: 5.5.1 :: Invalid command :"`cat /var/log/maillog | grep -c "dsn=5.5.1"`
echo "Bounced :: 5.5.2 :: Syntax error :"`cat /var/log/maillog | grep -c "dsn=5.5.2"`
echo "Bounced :: 5.5.3 :: Too many recipients :"`cat /var/log/maillog | grep -c "dsn=5.5.3"`
echo "Bounced :: 5.5.4 :: Invalid command arguments :"`cat /var/log/maillog | grep -c "dsn=5.5.4"`
echo "Bounced :: 5.5.5 :: Wrong protocol version :"`cat /var/log/maillog | grep -c "dsn=5.5.5"`
echo " "
# Message Content or Message Media Status #
echo "Bounced :: 5.6.0 :: Other or undefined media error :"`cat /var/log/maillog | grep -c "dsn=5.6.0"`
echo "Bounced :: 5.6.1 :: Media not supported :"`cat /var/log/maillog | grep -c "dsn=5.6.1"`
echo "Bounced :: 5.6.2 :: Conversion required and prohibited :"`cat /var/log/maillog | grep -c "dsn=5.6.2"`
echo "Bounced :: 5.6.3 :: Conversion required but not supported :"`cat /var/log/maillog | grep -c "dsn=5.6.3"`
echo "Bounced :: 5.6.4 :: Conversion with loss performed :"`cat /var/log/maillog | grep -c "dsn=5.6.4"`
echo "Bounced :: 5.6.5 :: Conversion failed :"`cat /var/log/maillog | grep -c "dsn=5.6.5"`
echo " "
# Security or Policy Status #
echo "Bounced :: 5.7.0 :: Other or undefined security status :"`cat /var/log/maillog | grep -c "dsn=5.7.0"`
echo "Bounced :: 5.7.1 :: Delivery not authorized, message refused :"`cat /var/log/maillog | grep -c "dsn=5.7.1"`
echo "Bounced :: 5.7.2 :: Mailing list expansion prohibited :"`cat /var/log/maillog | grep -c "dsn=5.7.2"`
echo "Bounced :: 5.7.3 :: Security conversion required but not possible :"`cat /var/log/maillog | grep -c "dsn=5.7.3"`
echo "Bounced :: 5.7.4 :: Security features not supported :"`cat /var/log/maillog | grep -c "dsn=5.7.4"`
echo "Bounced :: 5.7.5 :: Cryptographic failure :"`cat /var/log/maillog | grep -c "dsn=5.7.5"`
echo "Bounced :: 5.7.6 :: Cryptographic algorithm not supported :"`cat /var/log/maillog | grep -c "dsn=5.7.6"`
echo "Bounced :: 5.7.7 :: Message integrity failure :"`cat /var/log/maillog | grep -c "dsn=5.7.7"`
echo " "
############################################
# Custom Errors x.8.xxx & Success 2.xxx.xxx
############################################
echo "Sent Mail :: 2.0.0 :: Message Sent :"`cat /var/log/maillog | grep -c "dsn=2.0.0"`
echo " "
echo "Custom successes :: 2.8.x :: Custom sent Message :"`cat /var/log/maillog | grep "dsn=2." | grep -v "dsn=2.0.0" | grep -c "dsn=2."`
echo "Custom deferres :: 4.8.x :: Custom defferes Message :"`cat /var/log/maillog | grep -c "dsn=4.8."`
echo "Custom failures :: 5.8.x :: Custom Failure Message :"`cat /var/log/maillog | grep -c "dsn=5.8."`
############################################
# Filter for all bounced mail
############################################
cat /var/log/maillog | grep ": to=<" | grep -v "dsn=4." | grep -v "dsn=2." | awk '{print $7}' | grep -v "to=<\esozm" | grep -v "to=<\root" > bounced.log

Friday, July 24, 2009

FreeBSD - Ncurses menu config location

So something cool -

In FreeBSD when you install a port and encounter a ncurses ui and then hit ok, where does it go?

/var/db/posts/$portname/option

check it out some time :D

Thursday, July 23, 2009

FreeBSD - Installing postfix & sending your first mail

Postfix: Probably the premier replacement for sendmail, which comes with ux/linux.

$> cd /usr/ports/mail/postfix-current/
$> make install clean

At this point you will most likely be confronted by a ncurses menu. You can choose to enable options or not. We just want to go with stock options so tab to ok and hit enter. So this should just go on and do its marry thing. If you get any other boxes just stick with defaults and tab to ok, and install.

Now to test!

telnet to your local host on port 25, and then type the following:
$> telnet localhost 25

ehlo example.com

*After this you should get accouple messages that start with 250 - this is good!*

mail from: root@example.com

*another 250 message*

rcpt to: type_your_email_address_here_instead_of_this

*another 250 message*

data

*another message*

subject: This is a test message!!!
test message
.

*message about being queued*

quit

* This will exit telnet, and we will sleep the following command for a minute to check your mail log to see if its been sent *
$> sleep 60 && tail /var/log/maillog | grep sent

if it comes back with sent your gold and you've sent your first message.

**** Just a side note, this is how it works in linux - infact i had to configure linux more then bsd

Please respond if you have issues :)

FreeBSD - Adding/setting up Grub

So your from linux land or you just want to try something new... Try grub :)

Lets located grub:
#> whereis grub
/usr/ports/sysutils/grub

Move to grubs port directory and install it:
#> cd /usr/ports/sysutils/grub
#> make install clean

Make the Mbr writeable, which is needed for grub:
#> sysctl kern.geom.debugflags=16

Now for the fun part! Installing - if you have a basic install this work just fine
#> grub-install hd0
Entering the grub subsystem:
#> grub
grub> root (hd0,0,a)
grub> setup --stage2=/boot/grub/stage2 --prefix=/boot/grub (hd0)
grub> quit

Making a menu.lst file that will take you to a free bsd booter.
#> nano /boot/grub/menu.lst

title FreeBSD 7.2
root (hd0,0,a)
kernel /boot/loader

Reboot the box and cross your fingers ;)
#>reboot

So I hope this worked for you, it worked great on my VM machine, and a few other boxes i've installed.

Wednesday, July 22, 2009

FreeBSD - Adding/setting console to Bash

Mind you after the fresh install you will probably have to do this as your root user until you install su or sudo.

$ echo $SHELL
/bin/csh
$ cd /usr/ports/bash3/
$ make install clean
~ This will download extra components && files ~
$ chsh -s bash root
$ chsh -s bash $USER
$ exit

~ Relogin and verify ~

# echo $SHELL
/usr/local/bin/bash

^_^ you now have bash shell!

Tuesday, July 21, 2009

deb_clean

This cleans your source.list file, and then replaces the repos for debian 4 you can probably replace etch with lenny to update debian 5 boxes. It also accounts for the debian keyring update that recently occured

#!/bin/bash

# Designed to fix the repos on a legacy debian box.
# By L.C.

apt-get clean all ;
cat > /etc/apt/sources.list <# New Repo list
deb http://ftp.us.debian.org/debian/ etch main
deb-src http://ftp.us.debian.org/debian/ etch main
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib
EOF
apt-get -y --force-yes install debian-archive-keyring && apt-get update && apt-get -y --force-yes upgrade ;

Apt_ctrl - When yum isnt your thing.

Apt_ctrl or Apt Control -

This was really designed to simplify package management by myself. The initial implement came about as a response to those vendors out there whom like to remove yum, but later on even with yum reinstalled... well things just weren't all right. So..? I dev'd out this monster to attempt to bring some sainity. Granite this is not the end to the pain and suffer and yes it only works for Centos 5 atm and will probably only remain in support of centos until the need arises to move to fedora.
Give it a shot you might like it.


#!/bin/bash

### Apt Control ###
#
# Written by L.C. to reduce the suffering of a Centos5 install.
#

# installs coreutils
yum install coreutils -y;
# sets the redhat release to a variable - maybe later they will change the location of this file?
rh_file="/etc/redhat-release"
# acquiring the Architecture
plat_arch=`uname -i`
# determines OS
plat_os=`cat $rh_file | cut -d" " -f1`
if [ $plat_os == CentOS ] ;
then plat_type=el ;
else plat_type=fc ;
fi;
# Creates the release for the link - ie centos 5 = el5
plat_release=$plat_type`cat $rh_file | cut -d"." -f1 | cut -d' ' -f3`
# All variables get pulled into the link and then we request the file & install it
rpm -Uhv http://apt.sw.be/redhat/$plat_release/en/$plat_arch/rpmforge/RPMS/rpmforge-release-0.3.6-1.$plat_release.rf.$plat_arch.rpm
# we clean current repo's of potentially crappy data
yum clean all;
# we now do a fresh install of Apt-get
yum install apt -y;
# we echo commands into the os.list file to provide repos
echo 'repomd http://mirror.centos.org centos/$(VERSION)/os/$(ARCH)' > /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/updates/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/extras/$(ARCH)' >> /etc/apt/sources.list.d/os.list &&
echo 'repomd http://mirror.centos.org centos/$(VERSION)/fasttrack/$(ARCH)' >> /etc/apt/sources.list.d/os.list ;
# we now update our package list
apt-get update;
# we next will install required packages.
apt-get -y install php php-curl php-mysql php-cli postfix mysql-server php-pgsql nano screen mc vixie-cron rkhunter;

scron - A cron replacement

This piece below was designed a replacement to cron, because VPS's/VDS's were/are broken and eventually cron dies. So I coded up this installer with ideas and assistance from a co-worker for "Script Cron" or Scron to take the place of the broken vixie-cron and other crons.

Script:

#!/bin/bash

## SCron - When normal cron just isnt working ##
#
# Written by L.C. and R.P.
#

## This section builds all of scrons directories and scron.
echo "Generating directories for scron.. "
mkdir /usr/local/scron ;
chmod 700 /usr/local/scron ;
mkdir /usr/local/scron/jobs ;
chmod 700 /usr/local/scron/jobs ;
echo "Building Scron.. "
cat > /usr/local/scron/scron.sh <<\EOF
#!/bin/bash
#Scron - The 5 minute man
while [ 1 -eq 1 ]; do
for a in /usr/local/scron/jobs/*.sh; do
$a
done
sleep 300
done
EOF
chmod 700 /usr/local/scron/scron.sh ;
chattr +a +i /usr/local/scron/scron.sh ;
echo "Creating custom rc.local.. "
cat > /etc/rc.local <#!/bin/bash
# Scron custom RC.Local
screen -dmS loop /usr/local/scron/scron.sh
exit 0
EOF
## This section is for jobs optionally created upon install.
echo "Generating jobs that will run split_q and fail_restart... "
cat > /usr/local/scron/jobs/split_q.sh <#!/bin/bash
# Script to run split_q.php
php /usr/local/sendstudio/split_q.php
EOF
chmod 700 /usr/local/scron/jobs/split_q.sh
cat > /usr/local/scron/jobs/failed_restart.sh <#!/bin/bash
# Script to run fail_restart.php
php /usr/local/sendstudio/cron/fail_restart.php
EOF
chmod 700 /usr/local/scron/jobs/failed_restart.sh ;
## Patch fail_restart.sh so it will run cli send regardless of
## screen sessions.
cat > /usr/local/sendstudio/cron/fail_restart.sh <<\EOF
#!/bin/bash
screen -ls |grep send > /dev/null
if [[ $? == 0 ]]; then
screen -S send -d -m php /usr/local/sendstudio/clisend.php
fi
EOF
## since we have some custom cron jobs initially installed with
## our production installer we remove them.
echo "copying the maint script.. "
cp /usr/local/sendstudio/maint.sh /usr/local/scron/jobs/
echo "removing old cron.. "
rm -rf /etc/cron.d/obey
## Reboot at the end - optionally you could just run the same
## command in rc.local.
echo "Going down for a reboot"
init 6 ;

Sipie

Sipie - what can I say? Sirius radio via terminal woot woot.

I've done a few installs of this product, and it seems at a stand still. You can use gui with it if you install the correct packages. I've found that you get differing results amongst the installs.

Ubuntu 9.04 - just install requirements and get python2.4 & python2.5 - make sure you grab the older beautifulstonesoup and stick it in sipie's directory it totally hates the new one.

$> sudo apt-get install mplayer python-setuptools python-wxgtk2.6 subversion
$> svn co https://sipie.svn.sourceforge.net/svnroot/sipie sipie
$> cd sipie/

~~~ Install it ~~~~

$> wget http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.0.7.tar.gz
$> tar zxvf BeautifulSoup-3.0.7.tar.gz
$> cd BeautifulSoup-3.0.7/
$> cp BeautifulSoup.* ~/sipie/

Ideal way to execute this is probably insert something into your .bashrc .

echo 'alias sipie="python2.4 /home/$USER/sipie/sipie.py"' >> /home/$USER/.bashrc

$>sipie octane

Notes:

**** Fedora 10 - I almost got this to work perfectly with updating my system and installing system requirements.

This will require: rpmfusion/forge for non-free software.

**** Python 2.6 & 3.0 seem to just hate this app btw so I wouldnt bother. I installed as far back as 2.3 aswell, but 2.4 seemed best.

Saturday, January 31, 2009

3 Decent Voip Sip Apps for linux

So we recently did a lot of research in regards to linux and its progression, unfortunately it just doesn't make the grade for call centers maybe only casual

Several if not all sip/voip clients were tested for linux, and the best were:

Sjphone, Zoiper"free", and Ekiga

Sjphone/Ubuntu:

Worked well on low ram ( 333 to 512) but audio would go out off and on, and getting pcm support out of some cards while using pulse audio with mic boost on you could only hear people faintly. Dead in our books if there is sound quality issues.

With 1gb nothing changed.

Sjphone/Opensuse 10:

Low Ram: Audio would crap out about every 6 hours or so.
High Ram: Good for a day or so, but still looses audio, the tops we saw audio was about 3 days.
With Kernel patches: Same as above even with the km kernel patches.

Sjphone/Fedora 10:

Low Ram: alot of the same above.
High RAM: Much better quality but fedora still looses sound at an unpredictable rate and generally during conversations so we had to drop it.

Zoiper/Ubuntu:

We first did our initial testing on crap hardware with an average of 333mb ram on the boxes, with ubuntu 8.10 installed.

Most or all boxes crashed/lost audio daily or several times a day.

Next we boosted the ram in those boxes to 1gb.

Most or all boxes lasted a day with out loosing audio - I would say about 1 to 3 days tops 6 to 8hours use a day. Audio death was the only issue at that point most fixes included restarting GDM/shutting down the machine, waiting 10 seconds and starting, because the audio problem would carry over on the reboot.

Zoiper/Opensuse10:

Low/High ram this died quick and was way too low, seems like Opensuse doesnt like when you switch out audio cards either. Kernel patches helped some but audio dies frequently, 2 days tops on audio.

Zoiper/Fedora 10:

This seemed to be the best as we saw some issues with zoiper acting funny but 2/4 boxes tested stayed up for a week or so. Was very impressed.

Ekiga/Ubuntu:

Pretty solid but wouldnt support multiline incoming calls is why we ditched it. Mutliline is on the way from what I hear. Stayed up for 3 days solid with out much issues, had to reboot due to audio lost.

Ekiga/Opensuse 10 :

Same as above.

Ekiga/Fedora 10:

Pretty solid would go accouple more days then the two above on most machines.

From what I can tell if you have atleast a gig of ram and want to use sip/voip Fedora/Zoiper seems pretty solid.

Obviously this is a quick and dirty but should give you an idea of what is capable. I assume the stability in PulseAudio differs per distro, and it appears that from worst to best: Ubuntu -> opensuse -> fedora

-L

Wednesday, January 28, 2009

Sad state of linux audio -_-

Well, If anything will make you feel like a failure its taking pride in something that is broken, and trying to get it to work.

Our little Voip experiment at work ie a Sip client on Ubuntu 8.10/Fedora 10.

Here's how I pretty much f'd up, big time.

So back in November we ok'd looking at voip, and by December we had our first tester box running - Absolutely fine, with the sip client sjphone.04 . A week later this became problematic. We started to move that group over (6 people) Ha, sjphone.04 has a horrible frame work, with even a worse way of managing sound. So we went sjphone.08 which went abit better, but still no cigar - it wouldnt work on alot of PC's. We talked with the guys that built our asterisk pbx, and they recommended an obscure program called zoiper. Zoiper seemed to just work. We installed it on our flag ship test machine, and spread it out amongst the group. Almost instantly we started having issues like Audio would stop mid calls, the UI would freeze. The Audio stopping ment we actually had to [shut down] the machines, wait 10 seconds, and then boot again and for the ui freezes/some audio drops we had to restart GDM. So after some experimenting, and some investigating I discovered this is not a "Unique" occurance, but honestly the state of Audio. The state of linux audio makes me kind of heart broken ... this one of my first really large projects - It taught me alot but it really indicates how functionality like Audio is in the trash. So to make a long story short we gave a few other Distro's a shot and Audio still crashes, some machines it takes weeks some it takes hours. I've probably done enough debugging and analysis on my own time to go crazy.

-L