Magellan Linux

Annotation of /trunk/vzctl/magellan-del_ip.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 272 - (hide annotations) (download) (as text)
Sat Jul 21 22:43:26 2007 UTC (16 years, 10 months ago) by niro
File MIME type: application/x-sh
File size: 1664 byte(s)
-magellan specific vzctl files

1 niro 272 #!/bin/bash
2     # Copyright (C) 2000-2007 SWsoft. All rights reserved.
3     #
4     # This program is free software; you can redistribute it and/or modify
5     # it under the terms of the GNU General Public License as published by
6     # the Free Software Foundation; either version 2 of the License, or
7     # (at your option) any later version.
8     #
9     # This program is distributed in the hope that it will be useful,
10     # but WITHOUT ANY WARRANTY; without even the implied warranty of
11     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     # GNU General Public License for more details.
13     #
14     # You should have received a copy of the GNU General Public License
15     # along with this program; if not, write to the Free Software
16     # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17     #
18     #
19     # This script deletes IP alias(es) inside VE for Magellan like distros.
20     # For usage info see ve-alias_del(5) man page.
21     #
22     # Parameters are passed in environment variables.
23     # Required parameters:
24     # IP_ADDR - IPs to delete, several addresses should be divided by space
25     # Optional parameters:
26     # VE_STATE - state of VE; could be one of:
27     # starting | stopping | running | stopped
28    
29     VENET_DEV=venet0
30     IFCFG_DIR=/etc/conf.d
31     IFCFG=${IFCFG_DIR}/net.${VENET_DEV}
32    
33     function del_ip()
34     {
35     local found=
36     local ip ifname
37    
38     for ip in ${IP_ADDR}; do
39     ifname=$(grep -l -e "\\<${ip}\\>" ${IFCFG}:* | sed "s:${IFCFG_DIR}:net.::")
40     if [ -n "${ifname}" ]; then
41     ifconfig ${ifname} down
42     rm -f ${IFCFG_DIR}/net.${ifname}
43     found=true
44     fi
45     done
46     if [ -n "${found}" ]; then
47     /etc/init.d/network restart 2>/dev/null 1>/dev/null
48     fi
49     }
50    
51     del_ip
52     exit 0
53     # end of script

Properties

Name Value
svn:executable *