Mini Shell

Direktori : /proc/self/root/proc/thread-self/root/opt/sharedrads/extras/
Upload File :
Current File : //proc/self/root/proc/thread-self/root/opt/sharedrads/extras/replaceindex

#!/bin/bash
# Used to replace IMH holder index pages
# Vanessa V. 7/13/10 RADS

REPO=http://repo.imhadmin.net/open/imh/
BKDIR=/root/replaced
SKEL=/root/cpanel3-skel/public_html
LOG=$BKDIR/log
DATE=$(date +%D_%T)

if [ ! -d $BKDIR ]; then
	mkdir $BKDIR
fi
	touch $LOG

# Replace skel files

cd /root ; wget -q $REPO/default.htm

if [ ! -s /root/default.htm ]; then
	echo "Error downloading index file...quitting"
	exit 1
else
	rm -f $SKEL/index.htm
	rm -f $SKEL/index.html
	rm -f $SKEL/default.htm

	mv -f /root/default.htm $SKEL
fi

STRING="If you own this site, your new web hosting account is now activated"
STRING2="If you are visiting this site, please check back soon"

# Loop through and find index pages

for user in `/bin/ls -A /var/cpanel/users` ; do

	USERPATH=/home/$user/public_html
	array=($USERPATH/index.htm $USERPATH/index.html $USERPATH/default.htm)

	for index in ${array[*]}
	do
		if [ -f $index ]; then

			if grep "$STRING" $index >/dev/null && grep "$STRING2" $index >/dev/null ; then

			PAGEPATH=$(ls $index | cut -d/ -f1,2,3,4)
			PAGENAME=$(ls $index | cut -d/ -f5)

			# Replace index pages

			mv -f $index $BKDIR/$user-$PAGENAME
			cp -f $SKEL/default.htm $index
			chown $user:$user $index
                        MSG="Replaced $PAGENAME in $PAGEPATH"
			echo "$DATE : $MSG" >> $LOG
			echo $MSG

			fi

		fi

	done
done

Zerion Mini Shell 1.0