Skip to content

Category Archives: Linux and Unix

Script to document a Red Hat Enterprise Linux 3 system

This script should output html documenting the important parts of a system:
sysinfo
If anyone sees something I’ve left out, and I’m sure there’s a lot, please leave a comment.

Backing Up a Linux server in the DMZ to a Windows Share

This script connects to a remote Linux server and backs it up to a file share on a Windows server. Note, that because the version of smbfs used does not support files larger than 2GB the backup is split into multiple files. Later versions of smbfs don’t have this limitation.

?View Code BASH #!/bin/sh
RemHost=lnx-server
TarFile="/windows-server/lnx-server-backup/lnx-server.tar.gz."
[...]

Script to send alerts if disk usage too high

The following script will monitor file system usage and, if it goes above certain thresholds, send an email alert. Note that it will only send an alert once per threshold unless usage drops back below the threshold. This means that you won’t get bombarded with emails.
The script sends an email to the alias diskusage. [...]

Recovering a Linux System using CommVault

Scope
Linux is not Windows. You should not need to reinstall the operating system to restore it. This document describes a way to boot a Linux system from the Red Hat install CD so it can then be restored from a CommVault backup. It does not document how to do the actual restore within CommVault. [...]

Copying a directory tree in Unix or Linux

cd to the parent of the source directoryUse the following command:

tar -cf – sourcedir | "cd destdirparent && tar -xf -"
where:
sourcedir is the directory to copy
destdirparent is the parent directory to copy the directory to
The -f – option tells tar to write the archive to stdout or read the archive from stdin as the case [...]

Using ssh to copy a directory tree from one host to another

From the source host:cd to the parent directory
Use the following command:

tar cf – sourcedir | ssh username@destination "cd destdirparent && tar xf -"
where:
sourcedir is the directory to copy
username is your username on the remote (destination) host
destdirparent is the parent directory on the remote (destination) host