initial commit of a *whole bunch* of old Egressive shell scripts, used to make many people redundant.
This commit is contained in:
commit
43e0f5b59e
329 changed files with 31937 additions and 0 deletions
80
eghostingaccount/eghostingaccount
Executable file
80
eghostingaccount/eghostingaccount
Executable file
|
@ -0,0 +1,80 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# create a new account for a hosting customer, spit out the relevant details for an email
|
||||
# copyright Egressive Ltd, dave@egressive.com, http://egressive.com
|
||||
#
|
||||
# rob@egressive.com added directory structure and
|
||||
#
|
||||
# $1 short site name (eg egressive, hscr)
|
||||
# $2 admin userid (owner for directory structure)
|
||||
|
||||
#
|
||||
# create directory structure and ACLs
|
||||
#
|
||||
|
||||
HOMEBASE="/home"
|
||||
SITENAME=$1
|
||||
SITEHOME=$HOMEBASE/$SITENAME
|
||||
ADMINUSER=$2
|
||||
WEBSERVGROUP="www-data"
|
||||
WEBDIR=web
|
||||
|
||||
if [ $1"xxx" == "xxx" ] || [ $2"xxx" == "xxx" ]
|
||||
then
|
||||
echo usage: `basename $0` sitename admin-userid
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if getent passwd $ADMINUSER >> /dev/null
|
||||
then
|
||||
echo "ERROR: Admin user already exists"
|
||||
exit 1
|
||||
else
|
||||
echo . . . Creating admin user, please enter password when prompted
|
||||
adduser $ADMINUSER
|
||||
fi
|
||||
|
||||
# just in case the site name is different to the admin username
|
||||
if [ -d $SITEHOME ]
|
||||
then
|
||||
if [ -d $SITEHOME/$WEBDIR ]
|
||||
then
|
||||
echo "ERROR: Directory structure already exists"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
mkdir $SITEHOME
|
||||
fi
|
||||
|
||||
# set up the site directory
|
||||
echo . . . Create the site directory and set permissions
|
||||
chown $ADMINUSER:$ADMINUSER $SITEHOME
|
||||
chmod u=rwx,g=rwxs,o-rwx $SITEHOME
|
||||
setfacl --default -m g:$WEBSERVGROUP:rx $SITEHOME
|
||||
setfacl -m g:$WEBSERVGROUP:x $SITEHOME
|
||||
setfacl --default -m g:$WEBSERVGROUP:rx $SITEHOME
|
||||
|
||||
# set up log and web directories
|
||||
echo . . . Create the site subdirectories
|
||||
for i in $WEBDIR log
|
||||
do
|
||||
mkdir $SITEHOME/$i
|
||||
# chmod u=rwx,g=rwxs,o-rwx $SITEHOME/$i
|
||||
done
|
||||
|
||||
# set up web sub directories
|
||||
echo . . . Create the web subdirectories and set permissions
|
||||
for i in drupal $SITENAME-files $SITENAME-debug
|
||||
do
|
||||
mkdir $SITEHOME/$WEBDIR/$i
|
||||
setfacl --default -m g:$WEBSERVGROUP:rwx $SITEHOME/$WEBDIR/$i
|
||||
setfacl -m g:$WEBSERVGROUP:rwx $SITEHOME/$WEBDIR/$i
|
||||
done
|
||||
|
||||
echo Done setting up admin user and directory structure
|
||||
|
||||
#
|
||||
# create databases
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue