Skip to content

Instantly share code, notes, and snippets.

View benjamin-dk's full-sized avatar

Benjamin Christensen benjamin-dk

  • Aarhus Universitetshospital
View GitHub Profile
@benjamin-dk
benjamin-dk / drupal_permissions.sh
Created June 4, 2013 08:25
Linux bash script for setting correct Drupal permissions in the web folder
#!/bin/bash
#Securing file permissions and ownership: http://drupal.org/node/244924
#run the script as follows: sudo bash drupal_permissions.sh your/drupal/path your_user_name
path=${1%/}
user=${2}
group="www-data"
help="\nHelp: This script is used to fix permissions of a drupal installation\nyou need to provide the following arguments:\n\t 1) Path to your drupal installation\n\t 2) Username of the user that you want to give files/directories ownership\nNote: \"www-data\" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it manually by editing this script\n\nUsage: (sudo) bash ${0##*/} drupal_path user_name\n"
if [ -z "${path}" ] || [ ! -d "${path}/sites" ] || [ ! -f "${path}/modules/system/system.module" ]; then
@benjamin-dk
benjamin-dk / create_database.sh
Last active December 18, 2015 01:29
Linux bash script for setting up a new database and database user in MySQL
#!/bin/bash
# Command should follow this pattern: ./createdb testdb testuser secretpass
BTICK='`'
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`
echo "You will be prompted your mysql root password."