I did not find anything to allow me to exclude a user or users from the backups when using cpbackup so I made a couple modifications:
1st. I create a file called nobackup that contains the users I do not want to backup. One per line.
2nd. I created a script (I named mvuser): This script will take the users in my nobackup file, move them out of the /var/cpanel/users directory. This way when cpbackup runs it will not backup those users since it uses the users from the /var/cpanel/users directory.
3rd. This is the way I implemented it. I modified the cpbackup script but you could simple execute the mvuser script before and after the backups are completed.
Note: the mvuser script takes argument in and out. Out to move the users from the /var/cpanel/users and in to move them back in. So I simply have the cpbackup script execute mvuser out before I start the backup of the users and mvuser in when the backups are complete.Code:#!/bin/sh # mvuser - script to move users from /var/cpanel/users during backup # process. We move uses out of directory we do not want to backup # Script takes 1 argument. Either in or out. # Place the following two lines below the following line /scripts/cpbackup # close to line 280. Remember to remove the comment on the system line # sub backupaccts { # Move the users in nobackup back to users directory. See mvuser # system("mvuser out"); # And the following two lines before the closing "}" for the sub backupaccts # close to line 346. Remember to remove the comment on the system line # Move the users in nobackup back to users directory. See mvuser # system("mvuser in"); USERS=nobackup # list of users not to backup DIR=/var/cpanel/users TMPDIR=/tmp case $1 in out) # move the user file out temporarily for i in `cat $USERS` do mv $DIR/$i $TMPDIR echo "mv $DIR/$i $TMPDIR" done ;; in) # move the user file back to DIR for i in `cat $USERS` do mv $TMPDIR/$i $DIR chmod 644 $DIR/$i chown cpanel:root $DIR/$i done ;; *) echo "Usage: mvuser [in/out] ";; esac # # End #



LinkBack URL
About LinkBacks
Reply With Quote




