Find an IP address in files

Ever been looking for a config file that contains an incorrect IP address?

If the IP address you’re looking for is 8.8.8.8

Then this command is for you:

find . -type f -exec grep -l 8.8.8.8 {} \;

It’ll find all occurrences of 8.8.8.8 that appear in files in the current directory and folders below it. With that short list you should be able to find where you need to edit.

Location of the SugarCRM log file

By default it’s in the same base folder as the SugarCRM application files. But on occasion we’ll move it. Quickly find it’s location by looking in the config.php file. The two relevant lines are:


‘log_dir’ => ‘/var/log/sugarcrm/’,
‘log_file’ => ‘sugarcrm.log’,

If you’re at the command line, then this makes it easy:


grep 'log_dir' config.php

How to backup SugarCRM from the command line

From the linux command line, these commands let you backup and restore a SugarCRM database.

Update 2016-04-26: Just saw this SugarCRM KB Providing a Backup Without Sensitive Data which is really useful. Thanks Jared.

Firstly, for a proper back up of SugarCRM you’ll need two files, one containing the application files, one containing the SQL database.

First up, the backup…

Backup files:

Change to the folder you want to backup, then…

tar -zcvf CRM-BACKUP-FILES.tar.gz .

Edit: if you get an error ‘Permission Denied’ you may be trying to write to a folder you don’t have permission for, instead try writing to ~/CRM-BACKUP-FILES.tar.gz and it will likely work.
Edit: see also this StackOverflow article.

Backup sql (empty copy of the database):

mysqldump -u USERNAME -p -–no-data DATABASENAME > CRM-BACKUP-SQL.sql

Backup sql (with the data) :

mysqldump -u USERNAME -p DATABASENAME > CRM-BACKUP-SQL.sql

Then you can ‘tar’ the .sql file with

tar -zcvf DATABASENAME-mysql.tar.gz DATABASENAME-mysql.sql

Backup just a single table

mysqldump db_name table_name | gzip > table_name.sql.gz

If you only want the database schema, then in the SugarCRM web application you can do the following:

  • Admin
  • Diagnostic Tool
  • db schema
  • Download that file

Then for the restoration…

Restore files (to current folder):

tar -zxvf CRM-BACKUP-FILES.tar.gz

Restore sql:

mysql -u USERNAME -p DATABASENAME < CRM-BACKUP-SQL.sql

Restore just a single table

gunzip < table_name.sql.gz | mysql -u username -p db_name

These SugarCRM Knowledge Base articles may also be of use:

Get SAMBA running on linux

This article here describes how to get SAMBA running on a Raspberry Pi.

The protocol, which is known as the Common Internet File System (CIFS) – but was originally called Server Message Block (SMB), has been implemented on other operating systems including Linux. The most popular implementation is known as Samba and it allows devices like the Raspberry Pi to act as a CIFS file server. To put it another way, it allows a Windows PC to mount a folder on a Raspberry Pi and then copy, delete, read and write files on the it.
Installing and configuring Samba on a Raspberry Pi for basic file sharing is quite simple.

Download a file on dropbox using wget on linux

Firstly, get the dropbox share link. It will look like this

https://www.dropbox.com/s/ad2arn440pu77si/test.txt

Then add a “?dl=1” to the end of that url and a “-O filename” so that you end up with something like this:

wget https://www.dropbox.com/s/ad2arn440pu77si/test.txt?dl=1 -O test.txt

Now you can easily get files onto your linux box that aren’t available elsewhere.

Painless upgrade to WordPress 2.5

Just did yet another painless upgrade to WordPress, which is the software that powers this web site.

It is now running version 2.5 quite happily. What made this upgrade different was the fact that I did it from my laptop running Ubuntu 7.10.

Every other upgrade I’ve done from a Windows platform, using the FTP tool I’ve been familiar with, FileZilla.

The default install of Ubuntu hasn’t installed FileZilla, so it was a quick click to System | Administration | Synaptic Package Manager | Search | “Filezilla” | Mark for install | approve the dependancies | Apply.

In under a minute, FileZilla was installed and my favorite FTP tool was running just like it does on my Windows laptop. Yay! I just love how easy it is to install most things with Ubuntu.

More GRUB editing

Two pages I’ve found useful when playing with GRUB (a Boot loader that allows you to choose between multiple operating systems on boot up) are these:

It is nice to be able to re-order the menu items, change the length of time the menu stays on screen and change the wording of each entry.

Ubuntu & Wireshark sitting in a tree

Did a google for “Ubuntu wireshark install” hoping to get some instructions on how to get Wireshark installed under Ubuntu.

Found the following line: sudo apt-get install ethereal

and knowing that ethereal was the former name for wireshark, I promptly entered sudo apt-get install wireshark

at the command prompt. Lo and Behold, it starts installing Wireshark. I love it when stuff is sensible…

Ohh, oh, oh, it works too. Just like that.

Anyhow, getting back to what I was saying, it is really nice  when playing with a new program (or operating system) and things start falling into place with where to find things, how to do stuff.

One of the things I’m finding with Ubuntu is that while it is harder to install things (not by much tho) I’m finding that i’m actually more producting minute for minute than with Windows (XP or Vista)  – that is when typing a document or actually going to get something done, I’m taking less time with to do the doing. It isn’t that the programs are magically better (I don’t think) but rather that there are fewer distractions. Perhaps that will change with time and knowledge. I don’t know.

Ubuntu VPN goodness

I’m now running Ubuntu 7.10 on my personal laptop (it dual boots with MS Vista Ultimate, but defaults to Ubuntu). Of course I want to do it all, including connecting to MS Windows VPN’s.

The short set of instructions over at tipotheday were spot-on.

My only addition would be to have the Ubuntu 7.10 install CD (or ISO) handy. Personally I used the command line (CLI) version, worked a treat.