The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-03-2009
em23's Avatar
em23 em23 is offline
Registered User
  
 

Join Date: May 2008
Location: Chicago
Posts: 31
defining variables

Hey all, I was wondering if someone would take a look at this script I'm working on. I don't know if i have the syntax correct for my variables and if the for loop is written correctly.

any assistance would be greatly appreciated.

#!/usr/bin/bash

###########################################
# Written By: em
# Purpose: This script was written to make changes to a basic zone setup
# Date: 01 July 2008
###########################################

# My Variables
DMI_FILE="/etc/dmi/conf"
SNMP_FILE="/etc/snmp/conf"

##########
# Code
##########

if [[ -e $DMI_FILE ]]; then #check to see if the file exists
for conf in $($DMI_FILE)
do
mv conf conf.orig
done
else
print "$DMI_FILE does not exist"
exit
fi

echo "/etc/dmi/conf has been moved"

if [[ -e $SNMP_FILE ]]; then #check to see if the file exists
for conf in $($SNMP_FILE)
do
mv conf conf.orig
done
else
print "$SNMP_FILE does not exist"
exit
fi

echo "/etc/snmp/conf has been moved"


#
# disable services
#
/usr/sbin/svcadm disable svc:/network/finger:default
/usr/sbin/svcadm disable svc:/network/login:rlogin
/usr/sbin/svcadm disable svc:/network/shell:default
/usr/sbin/svcadm disable svc:/network/telnet:default
/usr/sbin/svcadm disable svc:/network/rpc/rstat:default
/usr/sbin/svcadm disable svc:/network/rpc/rusers:default
/usr/sbin/svcadm disable svc:/network/smtp:sendmail
/usr/sbin/svcadm disable svc:/network/ftp:default
/usr/sbin/svcadm disable svc:/system/filesystem/autofs:default

echo "The requested services have been disabled"

#
# disable automounter
#
/usr/bin/svcadm disable autofs

echo "automounter disabled"

#
# edit auto_master
#
vi /etc/auto_master

echo "Basic Zone Setup is complete"