Create a command prompt loop Linux

Example:

[root@servername~ ]# while [ 1 ]
> do
> date;
> df –h |grep backup;
> sleep 600;
> done

This creates a loop that checks the disks mounted to the directories with the name “backup” and displays the date every ten minutes. This is useful to see the progress of a very large sync command on a ten minute basis. Obviously it can be changed for virtually any command.

Note: the “while [ 1 ]” basically means the while is always true, thus the “sleep 600” is required. Otherwise you would have an infinite loop just going crazy.

You can kill the output with ctrl-c

-Andy



Backuppc: Moving the pool

Here are the instructions to create a dual disk system using backuppc. This approach creates a "copy" of the pool data without RAID. I have two external USB drives, both 500 Gig here. The advantage (I think) of this method is that if a mistake is made or a disk crashes no rebuilding is needed, just a copy. Also, the second disk can be removed for safe keeping, all we need is a replacement disk (no rebuilding)


1). Stop backuppc:
/etc/init.d/backuppc stop

2). Sync the current default location to your new mount point excluding "pc" (USB device = /data1):
rsync -avPH --exclude=pc/ --delete /var/lib/backuppc/ /data1/backuppc/
(This creates all the data for backuppc in /data1/backuppc, the "H" preserves hard links)

3). Move the old location to a new file, just in case:
mv /var/lib/backuppc /var/lib/backuppc_old

4). Change the /data1 mount point in /etc/fstab to mount /var/lib/backuppc, here's the line:
before: /dev/sdc /data1/backuppc ext3 defaults 0 0
after: /dev/sdc /var/lib/backuppc ext3 defaults 0 0

5). If there's a second disk, setup a crontab with an rsync:
rsync -aPH --exclude=pc/ --delete /var/lib/backuppc/ /data2/backuppc/ >/dev/null 2>&1

6). Reboot and verify the disk(s) are mounted correctlty

7). Start backuppc, /etc/init.d/backuppc start

8). After a few days if all is working remove /var/lib/backuppc_old

Note: Rather than creating a symbolic link from /var/lib/backuppc to /data1/backuppc I opted to create a static mount point in /etc/fstab. This is more straightforward. When someone runs "df -k" they'll see the giant mount point at /var/lib/backuppc and hopefully notice that it's a USB device.

Formatting USB: You may also have to format the USB drive with "mkfs.ext3 /dev/sdc". The device can be determined pretty easily with the Logical Volume Management Tool available in the GNOME GUI.

Further Note: Changing /etc/BackupPC/conf.pl and some of the files like "/usr/lib/BackupPC/Lib.pm" so the top directory is hard changed is NOT recommended. This is because someone else may update the backuppc package and the topDir will break.

-Andy



Coinfiguring a Sylog Server on Linux

Simple stuff, just no good resource out there:

1). Modify the line in /etc/syslog.conf from this:
*.info;mail.none;authpriv.none;cron.none /var/log/messages

To this
*.info;mail.none;authpriv.none;cron.none;local0.none /var/log/messages


2). Add the following two lines to the bottom of /etc/syslog.conf, the file “specialfilename” is the name of the new log:
# Firebox logs
local0.* /var/log/specialfilename

3). Modify /etc/syconfig/syslog so the”SYSLOGD_OPTIONS” look like this:
SYSLOGD_OPTIONS="-r -m 0"

4). Restart the syslog server:
[root@yourserver etc]# /etc/init.d/syslog restart
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]



This message was sent using the Picture and Video Messaging service from Verizon Wireless!

To learn how you can snap pictures and capture videos with your wireless phone visit www.verizonwireless.com/picture.

To play video messages sent to email, QuickTime® 6.5 or higher is required. Visit www.apple.com/quicktime/download to download the free player or upgrade your existing QuickTime® Player. Note: During the download process when asked to choose an installation type (Minimum, Recommended or Custom), select Minimum for faster download.



This message was sent using the Picture and Video Messaging service from Verizon Wireless!

To learn how you can snap pictures and capture videos with your wireless phone visit www.verizonwireless.com/picture.

To play video messages sent to email, QuickTime® 6.5 or higher is required. Visit www.apple.com/quicktime/download to download the free player or upgrade your existing QuickTime® Player. Note: During the download process when asked to choose an installation type (Minimum, Recommended or Custom), select Minimum for faster download.



This message was sent using the Picture and Video Messaging service from Verizon Wireless!

To learn how you can snap pictures and capture videos with your wireless phone visit www.verizonwireless.com/picture.

To play video messages sent to email, QuickTime® 6.5 or higher is required. Visit www.apple.com/quicktime/download to download the free player or upgrade your existing QuickTime® Player. Note: During the download process when asked to choose an installation type (Minimum, Recommended or Custom), select Minimum for faster download.



This message was sent using the Picture and Video Messaging service from Verizon Wireless!

To learn how you can snap pictures and capture videos with your wireless phone visit www.verizonwireless.com/picture.

To play video messages sent to email, QuickTime® 6.5 or higher is required. Visit www.apple.com/quicktime/download to download the free player or upgrade your existing QuickTime® Player. Note: During the download process when asked to choose an installation type (Minimum, Recommended or Custom), select Minimum for faster download.