Archive

Posts Tagged ‘ip’

Eseguire il backup delle directory di un server

April 28th, 2009

 Powered by Max Banner Ads 

nome script: /usr/local/sbin/backup_dir.sh

descrizione: Con questo script viene fatto il backup delle directory importanti server

Inserendo una riga simile nel cron scheduliamo il backup tutte le notti

cat /etc/cron.d/backup
MAILTO="postmaster@yourdomain.com"
00 21 * * * root test -x /usr/local/sbin/backup_dir.sh && /usr/local/sbin/backup_dir.sh
#!/bin/bash
#
# backup_dir.sh
# Con questo script viene fatto il backup delle directory importanti  server
#
hosts_internal=( your_host )
 
for host in ${hosts_internal[@]}
do
  echo "Download of /etc/ /usr/local/sbin/ /root/ /home/ directory from "$host" "
  echo -n "Starting ------>"
  date
  # bakup file for hosts
  tar -zcvf /var/backups/backup_files_"$host"_`date +"%d%m%Y"`.tar.gz /etc/ /usr/local/sbin/ /root/ /home/ ;
  mv /var/backups/backup_files_"$host"_`date +"%d%m%Y"`.tar.gz /backups/"$host"/;
  rm -f /var/backups/backup_files_"$host"_`date +"%d%m%Y"`.tar.gz
  echo -n "Stopping ------>"
  date
  echo ""
done

Fabio Laganà Debian, Shell, backup, bash , , ,

Add and Remove ip alias into OpenBSD System

December 5th, 2008

Set an IP Alias

To put a second IP address to the same interface, just enter on the commandline as root:

 OpenBSD# ifconfig re0 inet alias 192.168.10.199 netmask 255.255.255.0

This sets an IP address 192.168.10.199 to vr0. Check again with ifconfig:

 OpenBSD# ifconfig -A
 lo0: flags=8049 mtu 33208
         groups: lo
         inet 127.0.0.1 netmask 0xff000000
         inet6 ::1 prefixlen 128
         inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
 re0: flags=8843 mtu 1500
         lladdr 00:40:45:28:89:37
         groups: egress
         media: Ethernet autoselect (100baseTX full-duplex)
         status: active
         inet 192.168.1.199 netmask 0xffffff00 broadcast 192.168.1.255
         inet6 fe80::240:45ff:fe28:8937%vr0 prefixlen 64 scopeid 0x2
         inet 192.168.10.199 netmask 0xffffff00 broadcast 192.168.100.255

Now we see two IP addresses on vr0. If you want to set an IP address within the same network you would have to set a fake netmask of 255.255.255.255.

Make the IP Alias Permanent

If you use ifconfig to set an IP alias, the alias won’t be present after the next reboot. To make the setting permanent, add a line to /etc/hostname.<INTERFACE>:

 OpenBSD# vi /etc/hostname.vr0
 inet 192.168.1.199 255.255.255.0 NONE
         inet alias 192.168.10.199 255.255.255.0

Remove an IP Alias

You can remove an IP alias with a comand like this:

 OpenBSD# ifconfig re0 192.168.10.199 delete

This deletes the second IP address from the interface keeping the first.

Fabio Laganà OpenBSD, Shell , , , ,