Aug
01
2017
0

BASH script to cp/mv files of a certain date

I have a client that owns a high volume call center.  For quality assurance and training purposes they record all the calls.  Periodically the volume of recorded calls grows to the point that it slows down the NFS share to the Queuematrics call center software(Tomcat app).  I wrote a script that finds files by time and moves them to a different directory.

Usage: copy-by-date.sh -i INPUT_PATH -o OUTPUT_PATH -d +DAYS_OLD

(more…)

Jun
08
2017
0

How to Install and Configure Basic Git Server on CentOS 6

Git has changed my life.  I’m not exaggerating.  I work with a lot of ‘one off’ scripts (BASH, PHP, and Python).  They are spread out among systems and developed from my workstation and(sometimes) laptop.  I spent 15 years keeping multiple versions and copies of the same scripts spread between systems.  Looking back it seems Crazy!

While I’ve known about Git for years, but I had no idea how badly I needed it until I interviewed for a contract and the interviewer repeatedly mentioned Git as a crucial part of their development process.  I admitted to him that I didn’t use it, but I would set it up myself and answer his questions in the next interview.  I installed it and set out to learn the centralized Git workflow(similar to SVN; one master setup).  There are other workflows and I recommend taking a look at this post if you are curious: https://www.atlassian.com/git/tutorials/comparing-workflows  

Goals of this Post:

  • Install  and configure basic Git for centralized workflow

 

(more…)

Written by mattb in: Automation,Linux | Tags: , , , , ,
Jul
18
2009
1

How to use the ODBC driver to Connect to MySQL database in Fedora 10

A few weeks back I covered connecting ODBC to MS-SQL, but today we are going to do the same thing with MySQL.  The process is very similar.  One might ask, why use ODBC driver in the first place?  The reason is simple, there are many flavors of SQL and the ODBC driver allows one standard to connect them.  For that reason many software developers use ODBC for connecting their applications to SQL.

For my purposes, the Asterisk PBX platform can use ODBC to call ‘dial plan’ functions from the database, but that is another article!  This post assumes you have a working MySQL server and at least one table with data to pull from.

Goal of this Post:

– Install ODBC driver for MySQL
– configure odbc.ini
– configure odbcinst.ini
– verify connectivity with isql

(more…)

Jun
07
2009
--

How to Configure Linux ODBC Connections for MS SQL

Last week at work(VoiceIP Solutions) I did some research for Asterisk PBX integration with Microsoft CRM.  The customer likes open source Asterisk because of the cost savings, but they requires screen pop-ups, and click to dial from their Customer Relationship Management software.  So while my manager worked on the TAPI middleware, I was charged with figuring out how to connect to the MS SQL database.  This article was prompted by a desire to connect an Asterisk PBX to MS SQL, but the tutorial applies to Apache, Postfix, CRM, PHP or any Linux app that needs to do a remote query.  Also, while the focus of this article is aimed at MS SQL the same steps(with a few tweaks) can be used for connecting to Postgre, Sybase, MySQL, etc…

I’m a lot more famalier with MySQL & PostgreSQL, but MS SQL I haven’t touched since I had the silly notion about 10 years ago to become a Windows 2000 MCSE.  Incidently, I never did take the exams, because I was a broke student at the time and I was becoming increasingly interested in Linux and Cisco.

The logical choice is to use the UNIX ODBC driver.  ODBC stands for Open Database Connectivity.  ODBC is a well documented set of API’s that is available on many platforms.  However, their are subtle differences in it’s implentation and the protocols that run at application layer.  In other words ODBC is encapsulated when making calls to a database over a network (in this case, the TDS protocol).

I did some googling and found a number of incomplete tutorials for connecting Linux to MS SQL.  This article is intended to clarify some common configuration errors and will present you with example files.  For my demonstration I’m running Fedora 10 with the latest updates as of this writing.  This article assumes you have a working MS SQL datebase with the proper user permissions in mixed mode.  I put this one in bold because it stumped the MCSE database guy for a while.

Again, I want to point out I’m not a Microsoft DBA and will likely not be able to help you on that side of the configuration.  Also, there are many versions of SQL out there and the syntax to pull data differs slightly from one version to the next.  So you may need to do a little research to make the proper pulls.

The Goals of this Post:

– install ODBC and TDS on Fedora 10

– verify TDS can login into MS SQL server

– configure odbcinst.ini, odbc.ini and freetds.conf configuration files

(more…)

May
07
2009
0

How to make USB and DVD ROM drives work on Fedora 10

Lately, I’ve been working on Asterisk PBX related articles, but today we’re going to tackle a common problem with Fedora 10: getting drives to mount to the Desktop.  If you are experiencing trouble, the likely cause is that your current user, does not have permissions to access that hardware.  The reason for this has a lot to do with the security model of Linux.

In the old days computers came on large mainframes.  It was not practical for engineers and scientist to have their very own main frame, so Unix was designed to be a multi-user operating system.  Everyone connected their own keyboard & monitor.  The permission structure was set so only certain individual accounts could do certain things.  Like say, reboot a system or delete a database.

By contrast Microsoft Windows(thru XP) is a single user operating system.  In Windows you can create extra accounts, but any of those accounts can execute arbitrary code from anywhere in the file system (c:\\ drive).  Which is a big reason for the many attacks on Windows systems.

Recently my friend got a virus that made XP unbootable and stole his World of Warcraft account login and password.  The hacker then used that information to login to his account, change his password, and his accounts valid email address.  The hacker then sold all his gear and used his character to scam other people in bad trades.  The account became banned for “economic extortion” before my friend could get his Windows XP machine back up and running.  Now he runs WoW on WINE/Fedora 10.

An appeal to Blizzard got his account back after several days and many emails. My friend requested that they check the IP address of the hacker and compare that to his previous logins.  What if the virus had collected his bank account credentials instead?  In a way he got lucky.

Goals of this Post:

– correct authorizations in Fedora 10 and allow access to USB and DVD – ROM devices

It seems odd that someone would be unable to access a USB thumb drive on any modern desktop computer, but Red Hat the maker of Fedora Linux is far more interested in their commercial offering, Red Hat Enterprise Linux(RHEL).  They model RHEL development on previous versions of Fedora.  So desktop integration is obviously not their top priority; stability and security is.  This neglect has allowed rival Unbuntu Linux to come in and snatch up the Linux desktop market.  Big mistake Red Hat…  however with a little work we can make Fedora 10 desktop work well without them.

So to correct the permissions issue(from Gnome) start by clicking, System –> Preferences –> System –> Authorizations.  Fedora may ask you for your ‘root’ password.

fedora10-authorizations-usb

fedora10-authorizations-usb

Set access to allow anyone to mount and unmount USB and other devices!  I hope this helps.  It’s frustrating dealing with these little things, but hey, “it’s free”!  If it doesn’t take, leave a comment below and I’ll try to help.