03-09-2010
Naming convention script
OK, so a quick background:
I am a sys admin for a 1:1 deployment in academia with Macbooks, totaling around 6,000. Macbooks get shifted around from building to building and go to and from the repair center if hardware repair is needed. Often, some machines will get moved from one building to another and not be renamed. We have a standard naming convention that goes like this:
AAA_Asset#
Where AAA is the building abbreviation and the asset# is the actual asset tag of the machine, separated by an underscore.
Now, my network admin has done his job and chopped up every building into specific IPv4 VLANs. So, I know what subnets belong to what buildings. This is good.
So, if AAA_Asset# moved from it's current building to a building where BBB_asset# is the standard naming convention I would like to write a script that renames the machine to the proper naming convention.
I can determine what building it is by the second number of the IP address. So, 10.20.30.40 would tell me that the machine is in the 20 subnet and that belongs to building X.
I'd like to set up a shell script that parses the computer name and the second digit of the IP address and puts them into arguments and then depending on the IP address it will rename the first three initials of the computer name to the proper name reflecting what building it is in.
I know I can get the computer name and the IP by using the networksetup binary, but I am not quite sure how to pass all that info into a set of arguments that determines the proper convention and then applies it.
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
Hi All,
I need to know standard naming convention for Unix libraries (including all flavours of unix)..As I have gone through some sites and found out
The UNIX convention for naming of libraries is
lib<name>.so.<major>.<minor>.<revision>
so is it statndard . also does it change... (0 Replies)
Discussion started by: rkshukla14
0 Replies
2. Shell Programming and Scripting
Hi All,
I am looking for a Unix shell script for file naming such that the file names itself as KARAN0001.
The 4 digit sequence number must start at 0001 and end at 9999.
After 9999 is reached, the number must reset to 0001.
Can anyone please help me with that.
Thanks & Regards
... (2 Replies)
Discussion started by: karansachdeva
2 Replies
3. Hardware
For the selection of motherboards, is there any naming convention in the type numbers? There is usually a brand name and sometimes a version name, but more essential details like form factor, SATA speed and maximum amount of RAM is never given. Is there a reason for that? Is there any background... (2 Replies)
Discussion started by: figaro
2 Replies
4. Shell Programming and Scripting
i have a file staff.txt with contents
tom|25|New York
sims|40|London
neyo|18|Moscow
i want to label the column at the top, my output should be
Names|age|city of birth
tom|25|New York
sims|40|London
neyo|18|Moscow (4 Replies)
Discussion started by: blackzinga80
4 Replies
5. Shell Programming and Scripting
Hi ,
i have below files in wrk folder. file names are
1102090001.CLT
1102090003.CLT
1102100019.CLT
1102100020.CLT
the above files are concatenate to one file but that concatenate file name must be same naming convention. (date +%y%m%d)and 0001 count.
example : concatenate file... (9 Replies)
Discussion started by: krbala1985
9 Replies
6. Fedora
Hi Guys,
Where would i find the list of distribution codes.
For example.
samba-32bit-3.4.2 -1.1.3.1.x8664.rpm
In above rpm file it is indicated that its release is 1.1.3.1 .
The rpm is meant to be run for opensuse.
Where would i get the linking of release number and distribution.
... (2 Replies)
Discussion started by: pinga123
2 Replies
7. UNIX for Dummies Questions & Answers
I need this script to check if the first 3 letters of the file name are capital.
find . -type f -name *001.dpx -exec find {} ! -name ???_???_???_v??.??????.dpx \; >> ./Bad_FileNames.txt
Currently it finds the first frame of the sequence and tests that against the naming convention. It works... (6 Replies)
Discussion started by: scribling
6 Replies
8. Red Hat
Hi,
I am installing a new RHEL 5 application server containing JBOSS along with other specific 3rd party applications. I know that this usually gets installed in /opt but I was thinking of installing these on a new separtate lv / file system instead.
i.e.
/<my_new_FS_name>
rather than... (6 Replies)
Discussion started by: Duffs22
6 Replies
9. Shell Programming and Scripting
#!/bin/bash
while read inputline
do
what="$inputline"
echo $what;
if ;
then
exit
fi
$reextend $what
$print ls -a
done
this is my code i am trying to change all of the file types of a certain directory to another file type but im not all the way there can someone help please (3 Replies)
Discussion started by: domdom110
3 Replies
10. Shell Programming and Scripting
Hi
Currently we have nmon running on our Red hat Linux server.
The ouput file is now coming with the naming convention as "servername_160321_0010.nmon".
The output file naming convention has to be changed as "nmon_servername_daily_2016.03.21_00.00.00"
How can we do it ? Any suggestions... (10 Replies)
Discussion started by: newtoaixos
10 Replies
LEARN ABOUT MOJAVE
net-snmp-config
net-snmp-config(1) Net-SNMP net-snmp-config(1)
NAME
net-snmp-config - returns information about installed net-snmp libraries and binaries
SYNOPSIS
net-snmp-config [OPTIONS]
DESCRIPTION
The net-snmp-config shell script is designed to retrieve the configuration information about the libraries and binaries dealing with the
Simple Network Management Protocol (SNMP), built from the net-snmp source package. The information is particularily useful for applications
that need to link against the SNMP libraries and hence must know about any other libraries that must be linked in as well.
OPTIONS
--version
displays the net-snmp version number
--indent-options
displays the indent options from the Coding Style
--debug-tokens
displays a example command line to search to source code for a list of available debug tokens
SNMP Setup commands:
--create-snmpv3-user [-ro] [-a authpass] [-x privpass] [-X DES|AES]
[-A MD5|SHA] [username]
These options produce the various compilation flags needed when building external SNMP applications:
--base-cflags
lists additional compilation flags needed for external applications (excludes -I. and extra developer warning flags, if any)
--cflags
lists additional compilation flags needed
--libs lists libraries needed for building applications
--agent-libs
lists libraries needed for building subagents
--netsnmp-libs
lists netsnmp specific libraries
--external-libs
lists libraries needed by netsnmp libs
--netsnmp-agent-libs
lists netsnmp specific agent libraries
--external-agent-libs lists libraries needed by netsnmp libs
Automated subagent building (produces an OUTPUTNAME binary file): [This feature has not been extensively tested, use at your own risk.]
--compile-subagent OUTPUTNAME [--norm] [--cflags flags]
[--ldflags flags] mibmodule1.c [...]]
--norm leave the generated .c file around to read.
--cflags flags
extra cflags to use (e.g. -I...).
--ldflags flags
extra ld flags to use (e.g. -L... -l...).
Details on how the net-nsmp package was compiled:
--configure-options
Display original configure arguments
--snmpd-module-list
Display the modules compiled into the agent
--prefix
Display the installation prefix
V5.6.2.1 16 Nov 2006 net-snmp-config(1)