sh

MySQL Quick Backup

  • View
  • Edit
  • Delete
Situation: 
this function creates a demoDB.sql file of demoDB Database. The path may change according to your setup.


function dump_db {
/usr/local/mysql/bin/mysqldump -u root -p $1 > $1.sql
}


Add Hosts entry and apache vhost

  • View
  • Edit
  • Delete
Situation: 
Working with drupal locally might be a little bit annoying with the domain issues it can have. thats why a good option ( working with multiple installations ) is to create different host entries and create a vhost for each entry.


#Register a host in /etc/hosts
function register_host {
echo "127.0.0.1 $1.site" | sudo tee -a /etc/hosts
add_vhost $1 $2 $3 | sudo tee -a /etc/apache2/extra/httpd-vhosts.conf
sudo apachectl restart
}


function add_vhost {
echo "
#$3
<VirtualHost *:80>
ServerName $1.site
DocumentRoot /Users/webalab/$2
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common"
</VirtualHost>"
}

Usage:


Basic Functionality

  • View
  • Edit
  • Delete
Situation: 
The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.

$ sudo port selfupdate : Updates the macport's app list.
$ port list : List All packages
$ port search kwd : Search "kwd" in the packages list
$ port info pkg: Retrieve information about the pkg
$ port deps pkg: Show the dependencies of a pkg
$ port variants pkg : Show pkg variants
$ sudo port instal pkg: Install pkg
$ port clean --all pkg: Clean all the mess done by the app installation whatsoever
$ port uninstall pkg: Uninstal pkg


Powered by Drupal, an open source content management system