RSS Feed

Archive for the ‘Shell Script’ Category

Got a packet bigger than ‘max_allowed_packet’ bytes – MySql – Part 2

March 30, 2011 by admin No Comments »

This error appears when you are running a database import.

To fix this:
A:
1) If you can; open as administrator the my.cnf file under the mysqld or etc folder.
2) Locate the entry max_allowed_packet and set this to a bigger number as you wish. It should be around 1M by default.

B:
You can also, use mysql console to update the values as

set global net_buffer_length=[SOME_BIG_NUMBER]; 
set global max_allowed_packet=[SOME_BIG_NUMBER];

C:
You could also get away with only the following command. however in my case it seemed to work well with a combination of step A.

mysql --max_allowed_packet=[SOME_NUMBER]M -uroot -p [dbname] < dump.sql
 

How to open a folder from application launcher – Ubuntu

March 16, 2011 by admin 1 Comment »
gnome-terminal --working-directory=/path/to/directory/
 

Change Permissions on Directory and Files from command line

March 7, 2011 by admin No Comments »

Here is a snippet command for changing file/folder permissions via command line

find . -type d -exec chmod 755 {} \;

NOTE: Please also the permissions numbers as you prefer

 

Zip and Unzip files with gzip

January 11, 2011 by admin No Comments »

to zip a file

gzip filename.ext

To unzip

gzip -d filename.ext.gz
 

/bin/rm: Argument list too long

September 14, 2010 by admin No Comments »

If you have ever used rm command, you know it always works! You can imagine a shock when all of a sudden am running it and getting an an error /bin/rm: Argument list too long!!

The issue here is that there is a maximum list of items rm can handle at a time. Luckly, there is a work around to this limitation and thats the use of find and pipe

 find . -name 'sess_*' | xargs rm

Works amazing!!

 

Extract sql.gz file on command line

by admin No Comments »

If you want to extract the sql.gz backup file using the terminal command, here is the command to run

 gzip -d backup-20100910164109.sql.gz

This will create the .sql file for you. For more options, hit man gzip on your terminal.

 

How to synchronize two folders in Ubuntu linux

September 10, 2010 by admin No Comments »

If you want to synchronize two folders in Ubuntu via the terminal you can use this useful command

rsync -av source/folder/ destination/folder

Note:
The leading slashes are key with this command. Without it, rsync will move the entire folder rather than folder contents!

 

Magento Install with no sample data (Shell Script via SSH)

February 18, 2010 by admin No Comments »

Nice little shell script for installing magento via SSH without sample data.
Enjoy!

wget http://www.magentocommerce.com/downloads/assets/1.4.0.0/magento-1.4.0.0.tar.gz
tar -zxvf magento-1.4.0.0.tar.gz
mv magento/* magento/.htaccess .
chmod o+w var var/.htaccess app/etc
chmod -R o+w media
./pear mage-setup .
./pear install magento-core/Mage_All_Latest-stable
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -rf magento/ magento-1.4.0.0.tar.gz

MORE stuff::-
Installing magento via shell ssh

 

WordPress Install Shell Script, Linux

by admin No Comments »

Here is a nice little script to quickly install wordpress using Shell Script:
Enjoy

#!/bin/bash
wget http://wordpress.org/latest.zip
unzip latest.zip
cp -rf ./wordpress/* ./

Installing:
– Start browser and type path to your wordpress extraction folder:
– Follow instructions:
– create database and assign users.
– configure the wp-config.php file with given script (if wordpress cant do it itself)
– Install and continue with instructions.

 

Magento Install On Ubuntu Shell Script

by admin No Comments »

A nice little script for installing magento and sample data on Linux using shell script. Feel free to change to the right magento version of your preference.

DHOST=localhost
DBUSER=<username>
DBPASS=<password>
DBNAME=<dbname>

#
wget http://www.magentocommerce.com/downloads/assets/1.4.0.0/magento-1.4.0.0.tar.gz
#
wget http://www.magentocommerce.com/downloads/assets/1.2.0/magento-sample-data-1.2.0.tar.gz
#
tar -zxvf magento-1.4.0.0.tar.gz
#
tar -zxvf magento-sample-data-1.2.0.tar.gz
#
mv magento-sample-data-1.2.0/media/* magento/media/
#
mv magento-sample-data-1.2.0/magento_sample_data_for_1.2.0.sql magento/data.sql
#
mv magento/* magento/.htaccess .
#
chmod o+w var var/.htaccess app/etc
#
chmod -R o+w media
#
mysql -h $DBHOST -u $DBUSER -p$DBPASS $DBNAME < data.sql
#
./pear mage-setup .
#
./pear install magento-core/Mage_All_Latest-stable
#
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
#
rm -rf magento/ magento-sample-data-1.2.0/
#
rm -rf magento-1.4.0.0.tar.gz magento-sample-data-1.2.0.tar.gz data.sql