Magento Ecommerce Strategy, Design & Development

Command Line - copy files using rsync

rsync is a software application for Unix and Windows systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion. In daemon mode, rsync listens on the default TCP port of 873, serving files in the native rsync protocol or via a remote shell such as RSH or SSH. In the latter case, the rsync client executable must be installed on both the local and the remote host. I use rsync a lot specially to backup my important files between two computers, but also to keep my local slackware repository up to date. rsync is great to keep folders and files synchronized between two computers or in the same computer, you can backup all your important data to an external disk using rsync. rsync uses Copy files with rsync From local to remote computer rsync --progress --partial -avz /folder/to/copy/ user@remote.server:/remote/folder This will copy all files in /folder/to/copy/ to /remote/folder in the remote server, the folder copy itself will not be created in the remote computer, and only its contents will be copied, if you want the folder itself to also be created and then its contents copied inside the newly created copy folder, use this command. rsync --progress --partial -avz /folder/to/copy user@remote.server:/remote/folder Note the trailing slash after copy that makes the difference. The rest of options are: progress: will show the percentage of the file copied partial: tells rsync to

Read more

Command Line - tar and gz

Create tape archives and add or extract files. Syntax tar c [ bBeEfFhiklnopPqvwX [ 0-7 ] ] [ block ] [ tarfile ] [ exclude-file ] {-I include-file | -C directory | file | file } tar r [ bBeEfFhiklnqvw [ 0-7 ] ] [ block ] {-I include-file | -C directory | file | file } tar t [ BefFhiklnqvX [ 0-7 ] ] [ tarfile ] [ exclude-file ] {-I include-file | file } ... tar u [ bBeEfFhiklnqvw [ 0-7 ] ] [ block ] [ tarfile ] file ... tar x [ BefFhiklmnopqvwX [ 0-7 ] ] [ tarfile ] [ exclude-file ] [ file ... ] c Create. Writing begins at the beginning of the tarfile, instead of at the end. r Replace. The named file s are written at the end of the tarfile. A file created with extended headers must be updated with extended headers (see E flag under Function Modifiers). A file created without extended headers cannot be modified with extended headers. t Table of Contents. The names of the specified files are listed each time they occur in the tar file. If no file argument is given, the names of all files in the tarfile are listed. With the v function modifier, additional information for the specified files is displayed. u Update. The named file s are written at the end of the tarfile if they are not already in the tar file, or if they have been modified since last written to that tarfile. An update can be rather slow. A tarfile created on a 5.x system cannot be updated on a 4.x system. A file created with extended headers must be updated with extended headers (see E flag under Function Modifiers). A file created without extended headers cannot be modified with extended headers. x Extract or restore. The named file s are extracted from the tarfile and written to the directory specified in the tarfile, relative to the current directory. Use the relative path names of files and

Read more

Command Line – sar

sar - Collect, report, or save system activity information. From command line: $ sar -b This command shows the amount of traffic and you can check for spikes in traffic

Apache - access log monitoring

Using terminal: $ cd /var/log/httpd/ $ tail -f access_log | grep The -f means run continually until you hit Control - C to stop it ( the ip can be whatever your filtering the results to if your interested in an IP's traffic ) Drop the | grep and the IP if you want all traffic $ tail -f access_log

Command Line - search for all images in a folder

find /opt/wherever/you/want/to/search -type f -name *.jpg -ls You might have to do it a few times for different file types. Or you can just leave the "-name *.jpg" part out and it will just give you your report on ALL of your files. If you don't like full bytes you could pipe some commands together..... find /opt/wherever/you/want/to/search -type f -name *.jpg | awk '{system("ls -lh \""0"\"")}' Thanks Dave for this tidbit of information!

Magento Enterprise - Creating a share link instead of emails

If you are not using Magento's email invite function because its not what you need. If you want a share link that your customers can post on a blog, or on their web site and when they click the link and sign up, they are going to be set up as an invited friend. This takes advantage of Magento's native invite functionality, but using a different way to connect. Magento has an invite email that you can use, but there are times when that is not enough. This tutorial will help you understand how I adjusted to this task. Part I - Create a .htaccess Part II - Create the module Part III - Create the observer Part IV - What your code may look like to get it on a page in Magento

Magento - create a static block in footer

Static blocks are a Magento feature that makes adding content to your Magento site easy and convenient. Static blocks allow for your Magento site to be updated via the admin panel making it faster than having to “hard-code” every time you need to make a change to your website. Static blocks can be used anywhere on your Magento site to display text, images, & navigation. Some Magento designs have static blocks already in place for your convenience; however, you might have to install them yourself. Below is a simple tutorial on how to install a static block in the footer of your Magento site
Step One: Create Static Block in Your Magento Admin Magento Admin Panel—>Static Blocks—>Add New Block
1) Name your Static Block, in this case Custom footer Links
2) Label the Identifier (This is the link you will use to call the block later) in this case, custom-footer-links
3) Choose what store view you would like it to render in
4) Set Status to Enabled
5) Now for the fun part! Add your navigation links to the block. Make sure to use <style> to make them match your magento site’s color and theme.
Step Two: Inserting Code to Call the Static Block
This part is going to require you to FTP into your Magento site and modify footer.phtml app—>design—>frontend—->default—>(your template)—>template—>page—>footer.phtml Find where in the footer you want your navigation links to display and insert: <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘custom-footer-links’)->toHtml(); ?> Now most of the time the Static block should display just fine but in some cases you are going to have do some extra steps to have the block display. 1) Instead of inserting: <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘custom-footer-links’)->toHtml(); ?> Use: <reference name=”left”> <block type=”cms/block” name=”left.permanent.callout”> <action method=”setBlockId”><block_id>custom-footer-links</block_id> </action> </block> </reference> 2)Modify catalog.xml app—>design—>frontend—>default—>f002—>layout—>catalog.xml Add under <!– Mage_Catalog –> <block type=”cms/block” name=”left.permanent.callout”> <action method=”setBlockId”><block_id>custom-footer-links</block_id> </action> </block>