![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pulling the first and last character/number from a string. | LinuxRacr | Shell Programming and Scripting | 3 | 06-16-2008 09:08 PM |
| pulling scripts from unix to linux | pjconfig | UNIX for Dummies Questions & Answers | 3 | 12-21-2005 06:10 PM |
| pulling a column from a file in ksh | dangral | Shell Programming and Scripting | 8 | 01-13-2003 04:10 PM |
| pulling the following line from a file | peter.herlihy | UNIX for Dummies Questions & Answers | 4 | 08-29-2002 09:09 PM |
| Pulling out fields from a file | Saz | UNIX for Advanced & Expert Users | 2 | 09-30-2001 03:31 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Pulling correct value from Mapfile
Hi all,
I am trying to pull one value from a Mapfile, but the result is that I am getting all the values. The Mapfile maps the host name from the Backup Server to the host name in our Network Monitoring Server, as shown here: Mapfile Code:
cat zabbixhosts Helpdesk-fd:Server_Helpdesk Knowledge-fd:Server_Knowledge BaculaServer-fd:Server_Bacula Zabbix-fd:Server_Zabbix_1.4.2 The section of script that is failing is here: Code:
client=$(tail -n 38 /var/lib/bacula/log | grep -m 1 -F "Client" | awk -F" " '{ print $2; }')
echo Client is $client
echo
# get hostname from the Hostsfile
ZABBIX_HOST=`grep "[$client]" $ZABBIX_HOSTSFILE`
if [ $? -eq 0 ]; then
hostname=`echo "$ZABBIX_HOST" | cut -f2 -d:`
else
hostname=""
fi
echo Hostname is $hostname
Code:
./bacula2zabbix.sh Client is "BaculaServer-fd" Hostname is Server_Helpdesk Server_Knowledge Server_Bacula Server_Zabbix_1.4.2 Any advice would be greatly appreciated. Thanks. Last edited by MrKen; 07-03-2009 at 02:16 AM.. Reason: Bad cut n paste |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|