Extracting log file contents, with sed and awk.
Posted by Ryan on October 28, 2008 in Linux, Solaris
Extract data from a file that contains a list of information. Lets say I have a logfile /tmp/logfile that contains hostnames in the following format (See below). All I want is the hostname, nothing else. Typing grep and the hostname will return the entire line that contains that hostname. However using sed, awk, [...]
Common Linux commands and syntax
Posted by Ryan on September 28, 2008 in Linux, Solaris
A list of commands and their syntax, some of which for some reason, seem to escape me only when I need it.
tar -cvf <archive name> <source directory> (create an archive from a directory)
rsync -auEv <source directory> <destination directory> (copy files locally from one location to another keeping all permissions and modification dates and Executibility)
rsync -auvEe [...]
CentOS 4 Repository list
Posted by Ryan on September 23, 2008 in Linux
Lists the contents of a CentOS 4 base repository. I’m listing this because it has been a pain in the past to find a list of repositories for CentOS/RHEL. Also, if you need one for Centos 5 or 5.1, just change the 4’s to 5’s or 5.1’s in the output below.
CentOS 4
“Centos-Base.repo”
[base]
name=CentOS-$releasever – Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
#released updates
[updates]
name=CentOS-$releasever [...]
Netbackup 6.5, robtest unload failure
Posted by Ryan on August 30, 2008 in Windows
Environment: Windows 2003 server, Netbackup 6.5.1
Problem: Using robtest a move of the tape from a slot to the drive completes successfully however an “unload” operation of the drive results in the following error.
Error: Could not get tape parameters for {4,0,2,0}: Insufficient system resources exist to complete the requested service.
Fix: Change the tape device driver [...]
Setting up SSH public and private keys
Posted by Ryan on August 23, 2008 in ComputerInfo, Linux
Here is a walkthrough on how to utilize ssh public and private keys to transfer files via ssh and rsync on Linux. This will be accomplished without a password and on a scheduled basis using cron.
=======Environment=======
Computer1 (192.168.0.1) – machine running rsync of /home/bob from crontab.
Computer2 (192.168.0.2) – machine receiving files (/home/bob) from computer 1 and [...]
Shell Script, While Read
Posted by Ryan on July 26, 2008 in Linux, Solaris
The “while read” function of shell scripting is great for performing a common task on multiple pieces of data. Here, check out the code section, and I’ll explain more.
Purpose: To check if multiple rpm packages are installed on a linux OS.
Code:
#!/bin/sh
while read i #read from input and assign the variable “i” to each [...]
Perl Script, backup speeds v1.2
Posted by Ryan on July 20, 2008 in ComputerInfo
Ok here’s the new version. This includes media average needed per lto generation.
Code:
#!/usr/bin/perl
print “Enter the letter of the magnitude of data you need to backup (T(era),G(ig),M(eg),K(ilo)).\n”;
chomp($mag1 = <STDIN>); #takes the user input and assigns it to $mag1.
print “Enter the amount of the data you need to backup (1-999).\n”;
chomp($dataamt = <STDIN>); #takes the user input and [...]
Perl Script, backup speeds v1.1
Posted by Ryan on July 17, 2008 in ComputerInfo
Ok here’s the new one…This allows the user to define T, G or M for Terabytes, Gigabytes or Megabytes. Then enter a number between 1-999 that is then multiplied to the power the user specified in the previous step.
Future:
Still, make it dummy proof!
Code:
#!/usr/bin/perl
print “Enter the letter of the magnitude of data you need to backup [...]
Perl Script, backup speeds v1.0
Posted by Ryan on July 16, 2008 in ComputerInfo
This is as far as I’ve gotten with Perl (about 40 pages into the llama book actually..hey, its a start). The reason I made this script is to easily calculate the time it would take to backup a specified amount of data to a specified device.
Future improvements:
User specified data, in short-hand…not just in bytes. – [...]
Compiling Application Source Files
Posted by Ryan on March 16, 2008 in Linux, Solaris
If you find an application that you want, but can’t find a binary for it… you’re probably left only with the source code as an option. I have listed and briefly described the three main commands to properly configure and compile source code.
First unpack (gunzip, bunzip2, unzip) the application file(s)
Then “cd” into the unpacked [...]
Recent Comments