Current time: 11-25-2024, 10:42 PM Hello There, Guest! (LoginRegister)


Post Reply 
sql users / databases migration
Author Message
nicolas Offline
Junior Member
*

Posts: 21
Joined: Aug 2008
Reputation: 1
Post: #4
RE: sql users / databases migration
By the way, using your script I have made a script to recreate directories and correct ownerships + directory / file modes. Someone might find this usefull.

Quote:#!/bin/bash
#
# PROCESS DIRECTORY RIGHTS (OWNERSHIP & CHMOD)
#
# !!!! Edit path to mysql cnf file !!!!
mycnf=/home/manager/mysql.cnf

# sample mysql.cnf looks like this:
# [client]
# user=user_for_ispcp_database_usualy_root
# password=password_of_user

for domain_id in `echo "SELECT domain_id FROM ispcp.domain" | mysql --defaults-file=$mycnf -s`;
do
uid=`echo "SELECT domain_uid FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=$mycnf -s`;
gid=`echo "SELECT domain_gid FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=$mycnf -s`;
dmn=`echo "SELECT domain_name FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=$mycnf -s`;
echo "===========================================================";
echo " $dmn";
echo "===========================================================";

# process ftp
mkdir /var/www/virtual/$dmn
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn
chmod 770 /var/www/virtual/$dmn
chown -v vu$uid:www-data /var/www/virtual/$dmn

mkdir /var/www/virtual/$dmn/backups
chown -vR vu$uid:www-data /var/www/virtual/$dmn/backups
chmod 770 /var/www/virtual/$dmn/backups

mkdir /var/www/virtual/$dmn/cgi-bin
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn/cgi-bin
chmod 755 /var/www/virtual/$dmn/phptmp

mkdir /var/www/virtual/$dmn/errors
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn/errors
chmod 775 /var/www/virtual/$dmn/errors

mkdir /var/www/virtual/$dmn/htdocs
chown -vR vu$uid:vu$gid /var/www/virtual/$dmn/htdocs
chmod -R -s /var/www/virtual/$dmn/htdocs
chmod -R 664 /var/www/virtual/$dmn/htdocs
find /var/www/virtual/$dmn/htdocs -type d -exec chmod 775 {} \;

chown -v vu$uid:www-data /var/www/virtual/$dmn/.ht*
chmod 640 /var/www/virtual/$dmn/.ht*

mkdir /var/www/virtual/$dmn/logs
chown -vR vu$uid:www-data /var/www/virtual/$dmn/logs
chmod 770 /var/www/virtual/$dmn/logs

mkdir /var/www/virtual/$dmn/phptmp
chown -vR vu$uid:www-data /var/www/virtual/$dmn/phptmp
chmod 770 /var/www/virtual/$dmn/phptmp

mkdir /var/www/fcgi/$dmn
chown -vR vu$uid:vu$gid /var/www/fcgi/$dmn
chmod 755 /var/www/fcgi/$dmn

done

Edit: corrected ownership for /var/www/fcgi/* dirs
Edit2: fine tuned chmod under htdocs (775 for dirs and 664 for files)
(This post was last modified: 08-23-2008 01:03 AM by nicolas.)
08-22-2008 10:09 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
sql users / databases migration - nicolas - 08-22-2008, 08:26 PM
RE: sql users / databases migration - nicolas - 08-22-2008 10:09 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)