Personal tools

Difference between revisions of "Main Page"

From linux360

Jump to: navigation, search
(Expanded MRU lists to 10 items)
(Scripturi BASH)
Line 1: Line 1:
A început migrarea tutorialelor şi ghidurilor (HowTo) din forum în Wiki -- nu ezitaţi să daţi o mână de ajutor ;-)
+
== Exemple scripturi BASH ==
  
----
+
=== Script ce elimina zona asociata unui domeniu dat ca parametru de intrare ===
  
* Ultimele 10 [[:Category:HowTo|ghiduri]] actualizate:
+
Puteţi elimina porţiunea din named.conf de la
** [[MU Online sub wine|MU Online rulat cu Wine]] ([[:Category:VMs|maşini virtuale]]/[[:Category:Games|jocuri]])
+
<pre>zone "nume.domeniu.dat.ca.parametru.de.intrare" {</pre>
** [[Download si instalare E17 din CVS|Instalare automatizată E17 CVS]] ([[:Category:GEs|medii grafice]])
+
până la acolada închisă asociată acoladei deschise de mai sus.
** [[Imagini partitii cu dd|Imagini de partiţii cu <tt>dd</tt>]] ([[:Category:Backup|backup]])
+
Scriptul este:
** [[Instalare Qemu|Instalarea emulatorului Qemu]] ([[:Category:VMs|maşini virtuale]])
+
<pre>#!/bin/bash
** [[ATi video (2.6)|Placă video ATi pe nucleu 2.6]] ([[:Category:Drivers|drivere]])
+
 
** [[MRTG cu IPFM]] ([[:Category:WebStats|statistici grafice pe web]])
+
# Bind zone remove script
** [[Quagga on Linux|Quagga]] ([[:Category:Routing|rutare]])
+
#
* Ultimele 10 [[:Category:Tutorial|tutoriale]] actualizate:
+
# Copyright (C) 2005 Silvian Cretu <silvian86@yahoo.com>
** [[Supra%C3%AEnc%C4%83rcarea operatorilor %C3%AEn limbajul C-plus-plus|Supraîncărcarea operatorilor în ANSI C++]] ([[:Category:Programming|programare]])
+
#
** [[Iptables romana|Introducere în <tt>iptables</tt>]] ([[:Category:Firewall|filtrare trafic]])
+
# This program is free software; you can redistribute it and/or
 +
# modify it under the terms of the GNU General Public License
 +
# as published by the Free Software Foundation; either version 2
 +
# of the License, or (at your option) any later version.
 +
#
 +
# This program is distributed in the hope that it will be useful,
 +
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +
# GNU General Public License for more details.
 +
#
 +
# You should have received a copy of the GNU General Public License
 +
# along with this program; if not, write to the Free Software
 +
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 +
 
 +
if [ ! $# = 1 ]; then
 +
    echo "Usage: $0 domain";
 +
    echo "The path to named.conf is defined inside the script";
 +
    else
 +
pathToNamedDotConf=/etc/named.conf
 +
 +
x=$(grep -n "zone \"$1\" {" $pathToNamedDotConf | cut -f1 -d:)
 +
sed $x,/\}\;/d $pathToNamedDotConf > temp
 +
c=$(sed -n $x'p' < temp)
 +
if [ "x`echo $c | grep "zone"`" = "x" ]
 +
then
 +
sed $x' d' temp > $pathToNamedDotConf
 +
else
 +
cat temp > $pathToNamedDotConf
 +
fi
 +
rm temp
 +
exit
 +
fi</pre>

Revision as of 22:39, 24 November 2005

Exemple scripturi BASH

Script ce elimina zona asociata unui domeniu dat ca parametru de intrare

Puteţi elimina porţiunea din named.conf de la

zone "nume.domeniu.dat.ca.parametru.de.intrare" {

până la acolada închisă asociată acoladei deschise de mai sus. Scriptul este:

#!/bin/bash

# Bind zone remove script
#
# Copyright (C) 2005 Silvian Cretu <silvian86@yahoo.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

if [ ! $# = 1 ]; then
    echo "Usage: $0 domain";
    echo "The path to named.conf is defined inside the script";
    		 else
	pathToNamedDotConf=/etc/named.conf
	
	x=$(grep -n "zone \"$1\" {" $pathToNamedDotConf | cut -f1 -d:)
	sed $x,/\}\;/d $pathToNamedDotConf > temp
	c=$(sed -n $x'p' < temp)
	if [ "x`echo $c | grep "zone"`" = "x" ]
	then
		sed $x' d' temp > $pathToNamedDotConf
	else
		cat temp > $pathToNamedDotConf
	fi
	rm temp
	exit
fi