[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-backup/usr/share/se3/sbin/ -> chgbpcuser.sh (source)

   1  #!/bin/bash
   2  #
   3  ##### Script de modif uid user backuppc #####
   4  #
   5  # Auteur: wawa - modifs keyser 22/01/10
   6  #
   7  ## $Id: chgbpcuser.sh 8418 2015-01-27 23:57:30Z keyser $ ##
   8  #
   9  # /usr/share/se3/sbin/chgpbcuser.sh
  10  
  11  
  12  #init param bdd partie sauvegarde #
  13  . /usr/share/se3/includes/config.inc.sh -b 
  14  # . /usr/share/se3/includes/config.inc.sh -b 
  15  . /usr/share/se3/includes/functions.inc.sh
  16  
  17  cur_user=`grep "USER=" /etc/init.d/backuppc |cut -d= -f2`
  18  
  19  if [ "$bck_user" = "backuppc" ]; then
  20  
  21  #
  22  # Modification de l'uidNumber de bckuppc
  23  #
  24  
  25  echo "Modification de l'uidNumber de bckuppc"
  26  
  27  BPCN=`getent passwd backuppc | cut -d : -f3`
  28  bck_uidnumber=`mysql se3db -u $dbuser -p$dbpass -B -N -e "select value from params where name='bck_uidnumber'"`
  29  
  30  #sed -i "s/backuppc:x:$BPCN/backuppc:x:$bck_uidnumber/g" /etc/passwd
  31  
  32      if [ -z "$(grep "x:$bck_uidnumber:" /etc/passwd)" ]; then
  33        usermod -u $bck_uidnumber backuppc
  34        if [ "$?" != "0" ]; then
  35        bck_uidnumber=$(id backuppc -u)
  36        CHANGEMYSQL bck_uidnumber "$bck_uidnumber" 
  37        echo 
  38        fi
  39      else
  40        
  41        echo "conflit uidnumber ou uidnumber identique, pas de modif"
  42        bck_uidnumber=$(id backuppc -u)
  43        CHANGEMYSQL bck_uidnumber "$bck_uidnumber" 
  44        exit 1
  45      fi
  46  
  47  fi
  48  
  49  #
  50  # Modification de la config backuppc
  51  #
  52  
  53  if [ "$bck_user" != "$cur_user" ]; then
  54      echo "Modification de la config backuppc"
  55      sed -i "s/USER=$cur_user/USER=$bck_user/g" /etc/init.d/backuppc
  56      BADLINE=`grep "BackupPCUser}" /etc/backuppc/config.pl | cut -c 2-`
  57      GOODLINE=`echo $BADLINE |sed -e "s/$cur_user/$bck_user/g" `
  58      sed -i "s/$BADLINE/$GOODLINE/g" /etc/backuppc/config.pl
  59      #BADLINE=`grep "CgiAdminUsers}" /etc/backuppc/config.pl | cut -c 2-`
  60      #GOODLINE=`echo $BADLINE |sed -e "s/$cur_user/$bck_user/g" `
  61      #sed -i "s/$BADLINE/$GOODLINE/g" /etc/backuppc/config.pl
  62  fi
  63  
  64  # Mise en place des droits
  65  /usr/share/se3/scripts/permbackuppc


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1