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

Thursday, August 7, 2008

MySql - tut

linux~

1) Start after a fresh install:

#> mysql -u root

2) Set the password for first time:

From inside SQL:

mysql> set password for 'root'@'localhost' = password ('test')

From outside SQL:

#> mysqladmin -u root password test1

3) If password is set, to change password:

#> mysqladmin -u root -ptest1 password test2

4) See if mysql is running:

#> ps -ef | grep mysqld

5) Starting and Stopping mySQL:

Starting:

#> ./etc/init.d/mysql start

Stop:

#> ./usr/bin/mysqladmin -u root -p shutdown

6) Adding a user to Mysql Db

mysql> use mysql;

mysql> insert into user (host, user, password, select_priv, insert_priv, update_priv) values ('localhost', 'guest', password('guest123'), 'Y', 'Y', 'Y');

mysql>flush privileges;

mysql> select host, user, password from user where user = 'guest';

7) creating a database call tutorials:

mysql> create database tutorials

8) view values in the table

SELECT * FROM table_name

Sunday, August 3, 2008

1 Week Rinux ( Linux ) Challenge

So... you know, i do the windows and linux thing alot. Well offically ive put down windows crack addiction finally, and have VM'd it for school but thats it pretty much. Which you know this was coming once i go a serious unix/linux job, and as some of you may not know.. I DID! no more support coordination! I am a Linux Administrator now! Woot Woot!

So my wise idea was hell lets kick over to that Centos 5.0 update 2 install i have going on. *LOL* let me tell you, if you like ease of use, kids stick with Ubuntu... Centos is a night mare I've had to add repo's for almost everything i want to install. I have a botched version of VLC going on, botch version of almost everything, and if its not botched its bastardized to the max!

So heres my set up...

Centos5 - Vmwared out w/ Debian 4.0rc4/Ubuntu 8.04/Winxp SP3

Additional fun stuff:

So I thought I would add some essential links:

http://www.sklav.com/?q=node/2

Best noted resources here are: All the Rpm repo's

http://sabarish4u.wordpress.com/2008/07/14/install-vlc-videolan-on-centos-system/

Best noted resources here are: Yum Repo's & good practice

http://www.highonsolder.org/2007/11/play-sirius-internet-radio-on-linux.html

Best noted resources here are: Sirius installation on linux

http://www.fsdaily.com/

Best noted resources here are: OpenSource news and Howto's

http://www.ubuntugeek.com/

Best noted resources here are: Howto's for Ubuntu

http://www.cyberciti.biz/

Best noted resources here are: All around & Howto's

http://www.fosswire.com

Best noted resources here are: All around, Community News & Howto's


Sunday, April 20, 2008

Project considerations and proposals

Flashable Gentoo
-purchase 2 to 3 - 8gb flash drives ( Online vendor? www.outpost.com /www.zipzoomfly.com / www.buy.com / www.newegg.com )
-Reference site (www.gentoo.com / www.pendrivelinux.com )
-Gentoo (live CD version) ?
-A beer ( because linux is free as in beer!)

Minor notes ...
-Sabiyon might be a decent alternative
-Portage tree on the NAS?
-Upgrade NAS's (NSLU2) 2nd HD

Time frame: > 3 months perferably , 3 with minor set backs , > 4 months final touches?
Production project : No