Skip to content

Instantly share code, notes, and snippets.

@jasonsedwards
jasonsedwards / mysqlBackup.sh
Created February 4, 2014 15:07
Use this shell script to backup and compress a MySQL database and transmit it to FTP storage. Useful when wanting to backup the database for a website. Just remember to fill in the variables with your own information.
#!/bin/bash
#Variables
FILENAME=/loc/to/file/$(date +%Y%m%d).sql
FILENAMEREMOTE=/loc/to/file/$(date +%Y%m%d).sql
FTPHOSTNAME="ip and port"
FTPUSERNAME=""
FTPPASSWORD=""
SQLUSERNAME=""
SQLPASSWORD=""
@jasonsedwards
jasonsedwards / fileBackup.sh
Last active August 29, 2015 13:56
Use this shell script to backup and compress a set of files/folders and transmit it to FTP storage. Useful when wanting to backup and entire site. Just remember to fill in the variables with your own information.
#!/bin/bash
#Variables
FILELOC= /file/loc/
ARCHIVENAME=/file/loc/$(date +%Y%m%d).zip
FILENAMEREMOTE=/file/loc/$(date +%Y%m%d).zip
FTPHOSTNAME="ip and port"
FTPUSERNAME=""
FTPPASSWORD=""
@jasonsedwards
jasonsedwards / getouad.ps1
Created February 21, 2012 13:44
Get OU of User in Active Directory from Windows Powershell
# Function Find users OU
function getADGroup { param([string]$adfindtype, [string]$cName)
# Create A New ADSI Call
$root = [ADSI]''
# Create a New DirectorySearcher Object
$searcher = new-object System.DirectoryServices.DirectorySearcher($root)
# Set the filter to search for a specific CNAME
$searcher.filter = "(&(objectClass=$adfindtype) (sAMAccountName=$cName))"
# Set results in $adfind variable
$adfind = $searcher.findall()