Skip to content

Instantly share code, notes, and snippets.

View sahidursuman's full-sized avatar

Sahidur Rahman Suman sahidursuman

View GitHub Profile
#!/bin/sh
# Import a remote database into a local database
# ----------------------------------------------
#
# Based on http://danherd.net/quick-script-synchronise-from-a-remote-expressionengine-database/
#
# Don’t forget chmod +x to make the script executable.
#
# Change the extension to .command to run the script directly from OS X Finder.
#!/bin/sh
# Import a remote database into a local database
# ----------------------------------------------
#
# Based on http://danherd.net/quick-script-synchronise-from-a-remote-expressionengine-database/
#
# Don’t forget chmod +x to make the script executable.
#
# Change the extension to .command to run the script directly from OS X Finder.
@sahidursuman
sahidursuman / backup.sh
Last active August 29, 2015 14:07 — forked from amityweb/backup.sh
#!/bin/sh
rsync="/usr/bin/rsync"
################################
# VARIABLES
################################
# General Variables
remote_server="yourserver.com"
remote_port="22"
#!/bin/sh
rsync="/usr/bin/rsync"
################################
# VARIABLES
################################
# General Variables
remote_server="yourserver.com"
remote_port="22"
<?php
/**
* Simple PHP GIT deploy script
*
* Automatically deploy the code using php and git.
*/
// =========================================[ Configuration start ]===
/**
@sahidursuman
sahidursuman / deploy.rb
Last active August 29, 2015 14:07 — forked from r38y/deploy.rb
# this is for multistage deployments... to deploy to staging, do "cap staging deploy"
# this is also set up for passenger deployments
# change stuff where it says CHANGEME
# set stage-specific stuff in the task named after the stage below
set :domain, "CHANGME"
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :sync_directories, ["public/system/images"]
set :sync_backups, 3
set :db_file, "mongoid.yml"
set :db_drop, '--drop' # drop database (rewrites everything)
require 'capistrano/recipes/deploy/strategy/copy'
set :application, "YOUR APPLICATION NAME"
set :location, "YOUR DOMAIN (e.g. myapp.com)"
set :repository, "YOUR SOURCE CONTROL REPOSITORY"
set :user, "THE USER ON YOUR SERVER THAT WILL BE DEPLOYING"
set :local_user, "LOCAL USER"
set :database_name, "YOUR DATABASE NAME"
set :scm, SET WHAT SOURCE CONTROL METHOD YOU USE
set :sync_directories, ["public/assets", "public/galleries"]
set :sync_backups, 3
namespace :server_db do
task :get, :roles => :app do
puts "This task is designed to get database from the server"
puts "Example: cap ENV server_db:get"
timestamp = Time.new.strftime("%Y-%m-%d-%H%M%S")
tmp_dir = '~/tmp'
db_name = "viclarity_#{rails_env}"
db_dump = "#{db_name}_#{timestamp}"
db_dump_gz = "#{tmp_dir}/#{db_dump}.gz"