Posts Tagged ‘linux’

excluding files from tar

Wednesday, June 2nd, 2010

For the website I work on for my company I have a very large number of files in a single folder that is strictly data for the clients and not data I have to regularly modify.  So when I’m doing a tarball/gzip of my files on the server I need to exclude that folder and all it’s subfolders from the process, here it is:

~# tar -czf /home/test/download.tgz ./ --exclude="*/events/auto/*" --exclude="*/images/waveforms/*"

Till Next Time

setting up a domain-nameless domain

Monday, December 21st, 2009

My company’s website is being completely rewritten from scratch and I chose to move to A2hosting.com.  We are going with a Virtual Private Server (VPS) from them and have found a little difficulty setting up web access to it.

The main issue is that since the website is already up and running, I can’t just transfer the domain name to the new server and be done with it.  I need to be able to access the new website by just the IP address for a while, until we move the production site over to it.  This is not documented anywhere on A2hosting’s site that I could find.

The issue resides in the setup of IP address of the server through Kloxo.  I am unable to configure the domain to default to the domain of my choice.  The error checking of this function disallows the assigning of that domain name since the domain name does not currently resolve to the server’s IP address.The solution resides in the /etc/hosts file.  I had to set the IP to equate to the domain name that WILL be the correct name once the production site is moved over.

A quick little walkthrough:

Set the /etc/hosts file

IP Addresses link in Kloxo admin

IP Address table

IP Address info

Select the proper domain name for the IP Address

Hope this helps.

Till Next Time

size of linux folder

Thursday, December 10th, 2009

Another quick post here.  I can never remember the command for getting the size of a folder in linux.  A quick search brought me here.  Patched together a few commands and it goes like this:

~ du -sh /path/to/dir

Till Next Time

PS- isn’t it interesting that all my quick posts are about linux commands…

ahhh, cronjobs!

Tuesday, May 26th, 2009

One of the features of the new platform that I am working on is the ability to automatically retrieve all new seismic activities before the end-user posts that there has been an activity.  This will make the data transfer appear instantaneous to our clients and make us look all-around awesome.

So I have a script designed to run whenever I need it to automatically get any new activities and save them to the local database waiting for the end-user.  I set it up to run every 15 minutes until I got the multitudes of old data into the new platform.  I’m talking ~170,000 activities, and each activity takes about 45-90 seconds to process.

So below is my simple cronjob command to have it run every 15 minutes 24/7/365.

*/15 * * * * php /var/lib/symfony/cron/runcron.php >> /var/lib/symfony/cron/test_cron_log.log

Till Next Time

creating symlink in linux

Sunday, March 22nd, 2009

Here’s another quickie post.  I have to create symbolic links occasionally, and enough time has passed in between the uses that I always forget the syntax to create the link.  I got this bit of code from here.  So, without further ado:

ln -s <Destination> <linkName>

So for instance, I need a link from /var/www/web to /var/lib/symfony/web, the following works:

ln -s /var/lib/symfony/web /var/www/web

And voila! Done

Till Next Time

quickie bash cmd to copy all files except a single given file

Friday, March 13th, 2009

In working on my new prod server I only have write access to the symfony folder and www folder.  This isn’t a big deal in actual development, just in backing up my files.  I have become a zealot when it comes to backing up.  Not just backing up files, but keeping a log of where the development stands for each backup.

For instance, before I launch the backend application in symfony, I do a backup and then I do another backup right after I launch it, before I make any modifications.  This seems to help me when I mess something up so bad that I cannot recover from my mistakes.

Since I only have access to the two folders that I am going to be backing up, I don’t want to backup the already backed up files, I would start to take up an exponential amount of space for each backup.  Did a quick google and found the solution here.

cp -r `ls --ignore=file1` destinationDir

Simple and it works. :-)

Till Next Time