Current time: 11-26-2024, 09:48 PM Hello There, Guest! (LoginRegister)


Post Reply 
How to setup a server to follow development?
Author Message
gOOvER Offline
Banned

Posts: 3,561
Joined: Jul 2007
Post: #31
RE: How to setup a server to follow development?
Added postfix restart
05-21-2008 04:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #32
RE: How to setup a server to follow development?
v 0.0.3:
Add support for other distribution (Fedora, SuSE, Gentoo, RedHat) (I only tested with debian, please make backups if you have other distro)
Default variables are read from ispcp.conf.
maillogconvert.pl it`s updated too.
Other little tweaks.
PLEASE TEST BEFORE ADD TO WIKI. WORKS FOR ME BUT... you know Wink
TODO:
Still ispcp.conf it`s not modified.
PHP Code:
#!/bin/bash
#
# ispcp-nightly-update
# Version: 0.0.3 - 19.05.2008
# License: GPL
# Author : ispcomm
# Credits: ispcp development team
#
# Variables
BACKUPDIR="/var/www/backup"
TRUNK_DIR="/usr/src/ispcp"
REBUILD_SITES="yes"
SAVE_DEFAULT_BACKUP="yes"
DISTRO_UPD="yes"

function msg_exit(){
    echo $
1;exit;
}
function 
Extract_vars(){
    eval `
cat ${TRUNK_DIR}/${MAKEFILE} | grep -E "(INST_PREF|SYSTEM_CONF)="| sed -e 's/$(INST_PREF)//g'`
    for 
a in `cat ${SYSTEM_CONF}/ispcp.conf | grep -E "(ROOT_DIR|BACKUP_FILE_DIR|CMD_HTTPD|CMD_NAMED|CMD_MTA|CMD_ISPCPD|CMD_PFLOGSUM)"| sed -e 's/ //g'`
    do 
        
export $a
    done
    WWWDIR
=`echo ${ROOT_DIR} | awk -F "/ispcp" '{print $1}'`
}

#download/update trunk no longer remove old trunk (thanks kilburn)
echo "#### DOWNLOAD TRUNK ####"
mkdir -${TRUNK_DIR}
svn checkout http://www.isp-control.net/ispcp_svn/trunk/ ${TRUNK_DIR}
cd ${TRUNK_DIR}

echo 
"#### SO determining ####"
if [ -/etc/debian_version ]; then
    RELEASE
=`cat /etc/debian_version`
    case ${
RELEASEin
        2.0
VERSION="hamm";msg_exit "HAMM is not suported";;
        
2.1VERSION="slink";msg_exit "SLINK is not suported";;
        
2.2VERSION="potato";msg_exit "POTATO is not suported";;
        
3.0VERSION="woody";msg_exit "WOODY is not suported";;
        
3.1VERSION="sarge";;
        
4.0VERSION="etch";;
        
lenny*) VERSION="lenny";;
    
esac
    MAKEFILE
="Makefile"
    
Extract_vars
    
if [ $DISTRO_UPD == "yes" ] ; then
        
echo "#### SO UPDATE ####"
        
apt-get update;
        
apt-get -y dist-upgrade;
        
apt-get -y install `cat ./docs/Debian/debian-packages-${VERSION}`;
    
fi;
elif [ -/etc/fedora-release ]; then
    MAKEFILE
="Makefile.fedora"
    
Extract_vars
    
if [ $DISTRO_UPD == "yes" ] ; then
        msg_exit 
"Fedora is not suported yet"
        
yum -y install `cat ./docs/Fedora/fedora-packages`
        
cpan2rpm -i http://search.cpan.org/CPAN/authors/id/P/PH/PHOENIX/Term-ReadPassword-0.07.tar.gz
        
wget -/tmp/core http://hany.sk/mirror/fedora/releases/7/Everything/i386/os/Fedora/perl-Net-LibIDN-0.09-3.fc7.i386.rpm
        
rpm -/tmp/core/perl-Net-LibIDN-0.09-3.fc7.i386.rpm
        rm 
-/tmp/core/perl-Net-LibIDN-0.09-3.fc7.i386.rpm
    fi
;
elif [ -/etc/SuSE-release ]; then
    MAKEFILE
="Makefile.opensuse"
    
Extract_vars
    
if [ $DISTRO_UPD == "yes" ] ; then
        yast 
-`cat ./docs/OpenSuse/opensuse103-packages`
    
fi;
elif [ -/etc/gentoo-release ]; then
    MAKEFILE
="Makefile.gentoo"
    
Extract_vars
    
if [ $DISTRO_UPD == "yes" ] ; then
        emerge 
-uq `cat ./docs/Gentoo/gentoo-packages`
    
fi;
elif [ -/etc/redhat-release ]; then
    msg_exit 
"RedHat is not suported yet"
elif [ -/etc/slackware-version ]; then
    msg_exit 
"Slackware is not suported yet"
else
    
msg_exit "Unknown Linux ditribution: not suported"
fi

echo "#### BACKUP OLD FILES ####"
# Backup current installation
mkdir -p $BACKUPDIR
pushd $BACKUPDIR
if [ $SAVE_DEFAULT_BACKUP == "yes" ] ; then
    
#move ispcp/backups to a temporary location
    
mv -f $BACKUP_FILE_DIR .
fi
tar czpf 
"ispcp_backup-`date +'%Y-%m-%d %H-%M-%S'`.tar.gz" ${WWWDIR}/ispcp/
tar czpf "ispcp_backup-etc-`date +'%Y-%m-%d %H-%M-%S'`.tar.gz" ${SYSTEM_CONF}

echo 
"#### SAVEING SETTINGS ####"
cp -${WWWDIR}/ispcp/engine/ispcp-db-keys.pl .
cp -${WWWDIR}/ispcp/gui/include/ispcp-db-keys.php .
cp -${WWWDIR}/ispcp/gui/tools/pma/config.inc.php .
popd

echo "#### BUILDING ISPCP ####"
make -${MAKEFILEclean
make 
-${MAKEFILEinstall 

echo "#### STOPING ISPCP DAEMON ####"
$CMD_ISPCPD stop


echo "#### REMOVE OLD ISPCP ####"
rm -fR $ROOT_DIR

echo  "#### REMOVE .svn DIRECTORIES ####"
rm -fr `find ${INST_PREF} -type d -name '.svn'`

echo 
"#### UPDATE CURENT INSTALATION ####"
pushd ${INST_PREF}${WWWDIR}
rm -fr `find ispcp/ -type d -name '.svn'`
cp -R ispcp$WWWDIR
cp 
-${INST_PREF}${CMD_PFLOGSUM} ${CMD_PFLOGSUM}
popd

echo "#### RESTORE SETTINGS ####"
pushd $BACKUPDIR
cp 
-v ispcp-db-keys.pl ${WWWDIR}/ispcp/engine/
cp -v ispcp-db-keys.pl ${WWWDIR}/ispcp/engine/messager/
cp -v ispcp-db-keys.php ${WWWDIR}/ispcp/gui/include/
cp -v config.inc.php ${WWWDIR}/ispcp/gui/tools/pma/

echo 
"#### RESTORE BACKUPS ####"
if [ $SAVE_DEFAULT_BACKUP == "yes" ] ; then
    mv 
-f backups ${BACKUP_FILE_DIR}
fi
popd

echo "#### SETTING PERMISIONS ####"
pushd ${WWWDIR}/ispcp/engine/setup/
./
set-engine-permissions.sh
./set-gui-permissions.sh
popd
 
echo "#### COPYING /parts DIRECTORIES ####"
bla=`find ${INST_PREF}/etc/ispcp -type d -name 'parts'`;
for 
x in $bla;
do
    
bla2=`echo ${x} | awk -F"${INST_PREF}|/parts" '{print $2}'`
    
cp -R $x $bla2
done
 
echo "#### REBUILDING SITES ####"
if [ $REBUILD_SITES == "yes" ] ; then
# Some old releases require this. not necessary for current ones.
#DELETE FROM config WHERE name = 'DATABASE_REVISION';
#read -p "Enter mysql pasword on prompt"
cat <<EOF mysql -uroot -pYOURPASSWORD ispcp
UPDATE mail_users SET status
='toadd' where status='ok';
UPDATE domain SET domain_status 'change' WHERE domain_status 'ok';
UPDATE domain_aliasses SET alias_status 'change' WHERE alias_status 'ok';
UPDATE subdomain SET subdomain_status 'change' WHERE subdomain_status 'ok';
EOF
${ROOT_DIR}/engine/ispcp-rqst-mngr
fi

echo "#### Starting ispcp-daemon ####"
$CMD_ISPCPD start

echo "#### Deleting ispcp tmp Dir ####"
rm -fR ${INST_PREF}

echo 
"#### Restarting Services ####"
$CMD_HTTPD restart
$CMD_NAMED restart
$CMD_MTA restart 
05-31-2008 07:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
gOOvER Offline
Banned

Posts: 3,561
Joined: Jul 2007
Post: #33
RE: How to setup a server to follow development?
It works for me on Debian Smile . Only the litte Error happens "Stopping ispCP GUI-Backend communication Daemon: ispcp_daemon/sbin/start-stop-daemon: warning: failed to kill 11258: No such process" so i think, we should stop the daemon a second time.
05-31-2008 03:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #34
RE: How to setup a server to follow development?
gOOvER Wrote:"Stopping ispCP GUI-Backend communication Daemon: ispcp_daemon/sbin/start-stop-daemon: warning: failed to kill 11258: No such process"
I really can`t reproduce. I think the daemon was already stopped when you try.
05-31-2008 11:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ispcomm Offline
Junior Member
*

Posts: 93
Joined: Apr 2008
Reputation: 3
Post: #35
RE: How to setup a server to follow development?
sci2tech Wrote:
gOOvER Wrote:"Stopping ispCP GUI-Backend communication Daemon: ispcp_daemon/sbin/start-stop-daemon: warning: failed to kill 11258: No such process"
I really can`t reproduce. I think the daemon was already stopped when you try.
I have the same error, but the daemon gets stopped properly. It's probably a problem with the start/stop script (like trying to stop twice).

I might be debian-etch related (since I know sci2tech is using lenny).

I haven't looked in it since it "kind of works".


ispcomm.
06-02-2008 05:03 PM
Find all posts by this user Quote this message in a reply
gOOvER Offline
Banned

Posts: 3,561
Joined: Jul 2007
Post: #36
RE: How to setup a server to follow development?
Is the copy of the /parts faster then in the Last Version? The copy is done in under one second Smile
06-02-2008 11:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #37
RE: How to setup a server to follow development?
It`s suposed to be faster since i moved removing of .svn dirs in a single block. Also it`s kind of optimised (not so good with bash scripting but i learn fast Wink )
(This post was last modified: 06-03-2008 01:21 AM by sci2tech.)
06-03-2008 01:20 AM
Visit this user's website Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #38
RE: How to setup a server to follow development?
ispcomm Wrote:
gOOvER Wrote:"Stopping ispCP GUI-Backend communication Daemon: ispcp_daemon/sbin/start-stop-daemon: warning: failed to kill 11258: No such process"
I have the same error, but the daemon gets stopped properly. It's probably a problem with the start/stop script (like trying to stop twice).
I might be debian-etch related (since I know sci2tech is using lenny).
I haven't looked in it since it "kind of works".
ispcomm.
Tested on 3 computers (but all with lenny) and still can`t reproduce. Could be etch related but i`ve doubt
06-03-2008 06:48 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ispcomm Offline
Junior Member
*

Posts: 93
Joined: Apr 2008
Reputation: 3
Post: #39
RE: How to setup a server to follow development?
sci2tech Wrote:Tested on 3 computers (but all with lenny) and still can`t reproduce. Could be etch related but i`ve doubt
It's not related to your script. If I issue
Code:
/etc/init.d/ispcp_daemon stop
I get the error, but the daemon stops "properly". I haven't looked into this because of time. Will look at it asap. In the mean time, that error is only "cosmetic" and does not affect the functions of the script.

ispcomm.
06-03-2008 07:22 AM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #40
RE: How to setup a server to follow development?
I did understand that it`s not related to my script Smile
problem is generated from: /etc/init.d/ispcp_daemon
Quote:stop)
log_daemon_msg "Stopping $DESC" "$NAME"

killproc -p $PID $DAEMON

log_end_msg $?

[ ! -f "$PID" ] || rm -f $PID
;;
and /lib/lsb/init-function
Quote:killproc () {
local pidfile sig status base i name_param is_term_sig
pidfile=
name_param=
is_term_sig=no

OPTIND=1
while getopts p: opt ; do
case "$opt" in
p) pidfile="$OPTARG";;
esac
done
shift $(($OPTIND - 1))

base=${1##*/}
if [ ! $pidfile ]; then
pidfile=/var/run/$base.pid
name_param="--name $base"
fi

sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/')
sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
if [ -n "$sig" -o "$sig" = 15 -o "$sig" = TERM ]; then
is_term_sig=yes
fi
status=0
if [ ! "$is_term_sig" = yes ]; then
if [ -n "$sig" ]; then
/sbin/start-stop-daemon --stop --signal "$sig" --pidfile "$pidfile" --quiet $name_param || status="$?"
else
/sbin/start-stop-daemon --stop --pidfile "$pidfile" --quiet $name_param || status="$?"
fi
else
/sbin/start-stop-daemon --stop --pidfile "$pidfile" --retry 5 --quiet --oknodo $name_param || status="$?"
fi
if [ "$status" = 1 ]; then
if [ -n "$sig" ]; then
return 0
fi
return 0 # program is not running
fi

if [ "$status" = 0 -a "$is_term_sig" = yes ]; then
pidofproc -p $pidfile "$1" >/dev/null || rm -f "$pidfile"
fi
return 0
}
make a diff betwen mine /lib/lsb/init-function and yours maibe this is the problem
helper: http://www.mail-archive.com/debian-dpkg-...05965.html


Attached File(s)
.txt  init-functions.txt (Size: 8.31 KB / Downloads: 1)
(This post was last modified: 06-03-2008 08:06 AM by sci2tech.)
06-03-2008 07:33 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


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