Changeset 3129 for alternc/trunk
- Timestamp:
- 02/06/12 09:28:40 (16 months ago)
- Location:
- alternc/trunk
- Files:
-
- 4 edited
- 2 moved
-
etc/alternc/templates/bind/slaveip.conf (modified) (1 diff)
-
src/fixperms.sh (modified) (1 diff)
-
src/functions.sh (modified) (1 diff)
-
src/quota_edit (moved) (moved from alternc/trunk/src/quota_edit.sh) (1 diff, 1 prop)
-
src/quota_get (moved) (moved from alternc/trunk/src/quota_get.sh) (2 diffs, 1 prop)
-
src/slave_dns (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
alternc/trunk/etc/alternc/templates/bind/slaveip.conf
r374 r3129 1 1 // DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN 2 2 // Use the AlternC managment console instead. 3 // Do NOT remove any comment of this template 3 4 4 5 acl "allslaves" { 5 { 6 127.0.0.1; 7 }; 6 { 7 127.0.0.1; 8 //AUTO-SLAVES// 9 }; 8 10 }; -
alternc/trunk/src/fixperms.sh
r3121 r3129 106 106 } 107 107 108 mysql --defaults-file=/etc/alternc/my.cnf -B -e "$query" |grep -v ^uid|doone 108 mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |doone 109 -
alternc/trunk/src/functions.sh
r2939 r3129 24 24 print_user_letter() { 25 25 local user="$1" 26 echo "$user" | awk '{print substr($1, 1, 1)}'26 echo ${user:0:1} 27 27 } 28 28 -
alternc/trunk/src/quota_edit
-
Property
svn:mergeinfo
set to
/alternc/branches/benjamin-bureaubleu/src/quota_edit.sh merged eligible /alternc/branches/stable-1.0/src/quota_edit.sh merged eligible
r2860 r3129 1 1 #!/bin/bash 2 2 . /etc/alternc/local.sh 3 DATA_PART=`/bin/df ${ALTERNC_LOC} 2>/dev/null | /usr/bin/awk '/^\// { print $1 }'` 4 /usr/sbin/setquota -r -g $1 $2 $2 0 0 $DATA_PART 2>/dev/null || echo "Group quota are not enabled on /var/alternc." >&2 3 4 # Set disk quota to an user 5 # Won't work over NFS 6 7 MID=$1 8 SIZE=$2 9 10 if [ $# -ne 2 ] || [[ ! "$MID" =~ ^[0-9]+$ ]] || [[ ! "$SIZE" =~ ^[0-9]+$ ]]; then 11 echo "Usage: quota_edit <uid> <size>" 12 echo "Edit the quota of the AlternC account having uid <uid> the the available space to <size>" 13 exit 1 14 fi 15 16 DATA_PART=`$DF "${ALTERNC_LOC}/html" 2>/dev/null | $AWK 'NR==2 { print $1 }'` 17 /usr/sbin/setquota -r -g $MID $SIZE $SIZE 0 0 $DATA_PART 2>/dev/null || echo "Group quota are not enabled on /var/alternc." >&2 -
Property
svn:mergeinfo
set to
-
alternc/trunk/src/quota_get
-
Property
svn:mergeinfo
set to
/alternc/branches/benjamin-bureaubleu/src/quota_get.sh merged eligible /alternc/branches/stable-1.0/src/quota_get.sh merged eligible
r2862 r3129 10 10 WC=/usr/bin/wc 11 11 12 DATA_PART=`$DF ${ALTERNC_LOC} 2>/dev/null | $AWK '/^\// { print $1 }'` 12 MID=$1 13 14 if [ "x$MID" == "x" ] ; then 15 echo "Usage: quota_get <uid>" 16 echo "Get the quota of the AlternC account having uid <uid>" 17 exit 1 18 fi 19 20 # The second line is the one interesting 21 # We look precisely on the HTML directory. Why ? because it's surely 22 # the bigger one, and if someone separate it we need to look this one 23 # particulary. It should be interesting to cumulate quota of all mounted directory. 24 DATA_PART=`$DF "${ALTERNC_LOC}/html" 2>/dev/null | $AWK 'NR==2 { print $1 }'` 13 25 14 26 # quota will give over NFS will print the partition using the full NFS name … … 20 32 fi 21 33 22 # quota will split its display on two lines if QUOTA_PART is bigger than 15 23 # characters. *sigh* 24 PART_LEN=`echo -n "$QUOTA_PART" | $WC -c` 25 val=$( 26 if [ "$PART_LEN" -gt 15 ]; then 27 $QUOTA -g "$1" | 28 $SED -n -e "\\;${QUOTA_PART};,+1s/ *\([0-9]*\) .*/\1/p" | 29 $GREP -v '^$' 30 $QUOTA -g "$1" | 31 $SED -n -e "\\;${QUOTA_PART};,+1s/ *[0-9]* *\([0-9]*\) .*/\1/p" | 32 $GREP -v '^$' 33 else 34 $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$2'} 35 $QUOTA -g "$1" | $AWK /${QUOTA_PART//\//\\\/}/\ {print\ '$3'} 36 fi 37 ) 34 # Now we get the quota 35 val=$(quota -A -wg "$MID" |grep "$QUOTA_PART" | awk '{ print $2 "\n" $3; }') 38 36 39 37 # If the quota aren't activated, I return something anyway 40 38 if [ -z "$val" ] ; then 41 echo 0 42 echo 0 43 else 39 echo -e "0\n0" 40 else 44 41 echo -e "$val" 45 42 fi -
Property
svn:mergeinfo
set to
-
alternc/trunk/src/slave_dns
r1798 r3129 1 #!/usr/bin/php -q 2 <?php 1 #!/bin/bash 3 2 4 /* 5 $Id: slave_dns,v 1.5 2004/11/25 17:20:55 anonymous Exp $ 6 ---------------------------------------------------------------------- 7 AlternC - Web Hosting System 8 Copyright (C) 2002 by the AlternC Development Team. 9 http://alternc.org/ 10 ---------------------------------------------------------------------- 11 Based on: 12 Valentin Lacambre's web hosting softwares: http://altern.org/ 13 ---------------------------------------------------------------------- 14 LICENSE 3 # Rebuild the bind configuration's file 4 # with the IP of the slave dns 15 5 16 This program is free software; you can redistribute it and/or 17 modify it under the terms of the GNU General Public License (GPL) 18 as published by the Free Software Foundation; either version 2 19 of the License, or (at your option) any later version. 6 FLAGFILE="/var/run/alternc/refresh_slave"; 7 TPL="/etc/alternc/templates/bind/slaveip.conf" 8 TARGET="/var/alternc/bind/slaveip.conf" 9 TMP=$(mktemp /tmp/slaveip.conf.XXXX) 20 10 21 This program is distributed in the hope that it will be useful, 22 but WITHOUT ANY WARRANTY; without even the implied warranty of23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the24 GNU General Public License for more details. 11 if [ ! -e "$FLAGFILE" ] ; then 12 # Nothing to do 13 exit 0 14 fi 25 15 26 To read the license please visit http://www.gnu.org/copyleft/gpl.html 27 ---------------------------------------------------------------------- 28 Original Author of file: Benjamin Sonntag 29 Purpose of file: Manage allowed slave dns ip addresses / classes 30 ---------------------------------------------------------------------- 16 # Source some functions 17 . /usr/lib/alternc/functions.sh 31 18 32 */ 19 # Get the slave IP. Remove the "newline" caracters 20 val=$(mysql_query "SELECT concat(ip,'::',class,'; ') FROM slaveip;"|tr '\n' ' ') 33 21 34 $FLAGFILE="/var/run/alternc/refresh_slave"; 22 # Add the slaves to the templates, re-add the missing "/" separator of subnet 23 cat "$TPL" | sed -e "s/\/\/AUTO-SLAVES\/\//$val/g" -e "s/::/\//g" > "$TMP" 35 24 36 if (file_exists($FLAGFILE)) { 37 unlink($FLAGFILE); 38 include("/var/alternc/bureau/class/local.php"); 39 mysql_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD); 40 mysql_select_db($L_MYSQL_DATABASE); 41 $r=mysql_query("SELECT * FROM slaveip"); 42 $f=fopen("/var/alternc/bind/slaveip.conf","wb"); 43 fputs($f," 44 // DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN 45 // Use the AlternC managment console instead. 46 acl \"allslaves\" { 47 { 48 127.0.0.1; // myself, just to be sure 49 "); 50 while ($c=mysql_fetch_array($r)) { 51 fputs($f,$c['ip']."/".$c['class'].";\n"); 52 } 53 fputs($f,"};\n};\n"); 54 fclose($f); 55 exec("invoke-rc.d bind9 reload"); 56 } 25 # Activate the new configuration 26 mv "$TMP" "$TARGET" 27 chown root:bind "$TARGET" 28 chmod 640 "$TARGET" 57 29 30 invoke-rc.d bind9 reload
Note: See TracChangeset
for help on using the changeset viewer.
