LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 09-30-2009, 01:21 AM   #1
rust8y
Member
 
Registered: May 2006
Posts: 100

Rep: Reputation: 15
pntadm


pntadm -P 10.187.50.0 | grep 04

This returns a list of entries that has the flag "04".

If the flag is 04, I manually type

pntadm -M 10.187.50.xx -f 00 10.187.50.0

Can you help me with a script that reads the entries and change the flags to 00 when it is flag 04?
 
Old 10-01-2009, 12:57 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Please provide more details about what pntadm outputs and what xx should be replaced with.
 
Old 10-02-2009, 04:17 AM   #3
rust8y
Member
 
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
Example:

# pntadm -L

10.187.70.0

# pntadm -P 10.187.70.0 | grep 04
010018B034BD09 00 10.187.70.104 10.187.26.50 10/02/2009 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.201 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
0100E075F30708 04 10.187.70.203 10.187.26.50 09/15/2009 10.187.70.0 IPTel VLAN 32
0100E075F30708 04 10.187.70.113 10.187.26.50 09/03/2009 10.187.70.0 IPTel VLAN 32
010018B034BCF7 04 10.187.70.69 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
01000AE40D651A 04 10.187.70.116 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
010018B034B00A 04 10.187.70.236 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3DB7 04 10.187.70.21 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3D06 04 10.187.70.102 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3BA0 04 10.187.70.176 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
010018B034BCF2 04 10.187.70.65 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3B37 04 10.187.70.196 10.187.26.50 12/19/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3D14 04 10.187.70.221 10.187.26.50 10/14/2007 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.15 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.238 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.191 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.136 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.149 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.204 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.80 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.160 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.131 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.170 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.220 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.62 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.91 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.26 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.182 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.234 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.88 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.156 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.115 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
01000AE40D6507 04 10.187.70.254 10.187.26.50 02/07/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3CD8 04 10.187.70.253 10.187.26.50 03/05/2007 10.187.70.0 IPTel VLAN 32
010018B034BCFA 04 10.187.70.247 10.187.26.50 03/08/2007 10.187.70.0 IPTel VLAN 32
010018B034BD09 04 10.187.70.243 10.187.26.50 03/06/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3C78 04 10.187.70.242 10.187.26.50 02/07/2007 10.187.70.0 IPTel VLAN 32
00 04 10.187.70.239 10.187.26.50 Zero 10.187.70.0 IPTel VLAN 32
010018B034BD95 04 10.187.70.237 10.187.26.50 03/08/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3D93 04 10.187.70.235 10.187.26.50 03/14/2007 10.187.70.0 IPTel VLAN 32
01000AE40D6543 04 10.187.70.233 10.187.26.50 02/07/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3DA5 04 10.187.70.232 10.187.26.50 03/08/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3DBA 04 10.187.70.228 10.187.26.50 02/07/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3D54 04 10.187.70.225 10.187.26.50 03/08/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3DAA 04 10.187.70.223 10.187.26.50 02/07/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3D0A 04 10.187.70.222 10.187.26.50 02/07/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3C5D 04 10.187.70.216 10.187.26.50 02/20/2007 10.187.70.0 IPTel VLAN 32
01000AE40D3D54 04 10.187.70.214 10.187.26.50 02/20/2007 10.187.70.0 IPTel VLAN 32
# pntadm -M 10.187.70.201 -f 00 10.187.70.0
# pntadm -M 10.187.70.203 -f 00 10.187.70.0
#
 
Old 10-02-2009, 04:38 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That should work:
Code:
pntadm -P 10.187.70.0 | nawk '$2 == "04" { printf("pntadm -M %s -f %s\n",$3,$6); }' >/tmp/doIt
ksh /tmp/doIt
You may want to check what the /tmp/doIt script contains before executing it.
 
Old 10-03-2009, 09:24 AM   #5
rust8y
Member
 
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
Many thanks
 
Old 10-05-2009, 05:57 PM   #6
rust8y
Member
 
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
# pntadm -P 10.187.70.0 | nawk '$2 == "04" { printf("pntadm -M %s -f %s\n",$3,$6); }' >/tmp/doIt
# cat /tmp/doIt
pntadm -M 10.187.70.113 -f 10.187.70.0
pntadm -M 10.187.70.69 -f 10.187.70.0
pntadm -M 10.187.70.116 -f 10.187.70.0
pntadm -M 10.187.70.236 -f 10.187.70.0
pntadm -M 10.187.70.21 -f 10.187.70.0
pntadm -M 10.187.70.102 -f 10.187.70.0
pntadm -M 10.187.70.176 -f 10.187.70.0
pntadm -M 10.187.70.65 -f 10.187.70.0
pntadm -M 10.187.70.196 -f 10.187.70.0
pntadm -M 10.187.70.221 -f 10.187.70.0
pntadm -M 10.187.70.15 -f 10.187.70.0
pntadm -M 10.187.70.238 -f 10.187.70.0
pntadm -M 10.187.70.191 -f 10.187.70.0
pntadm -M 10.187.70.136 -f 10.187.70.0
pntadm -M 10.187.70.149 -f 10.187.70.0
pntadm -M 10.187.70.204 -f 10.187.70.0
pntadm -M 10.187.70.80 -f 10.187.70.0
pntadm -M 10.187.70.160 -f 10.187.70.0
pntadm -M 10.187.70.131 -f 10.187.70.0
pntadm -M 10.187.70.170 -f 10.187.70.0
pntadm -M 10.187.70.220 -f 10.187.70.0
pntadm -M 10.187.70.62 -f 10.187.70.0
pntadm -M 10.187.70.91 -f 10.187.70.0
pntadm -M 10.187.70.26 -f 10.187.70.0
pntadm -M 10.187.70.182 -f 10.187.70.0
pntadm -M 10.187.70.234 -f 10.187.70.0
pntadm -M 10.187.70.88 -f 10.187.70.0
pntadm -M 10.187.70.156 -f 10.187.70.0
pntadm -M 10.187.70.115 -f 10.187.70.0
pntadm -M 10.187.70.254 -f 10.187.70.0
pntadm -M 10.187.70.253 -f 10.187.70.0
pntadm -M 10.187.70.247 -f 10.187.70.0
pntadm -M 10.187.70.243 -f 10.187.70.0
pntadm -M 10.187.70.242 -f 10.187.70.0
pntadm -M 10.187.70.239 -f 10.187.70.0
pntadm -M 10.187.70.237 -f 10.187.70.0
pntadm -M 10.187.70.235 -f 10.187.70.0
pntadm -M 10.187.70.233 -f 10.187.70.0
pntadm -M 10.187.70.232 -f 10.187.70.0
pntadm -M 10.187.70.228 -f 10.187.70.0
pntadm -M 10.187.70.225 -f 10.187.70.0
pntadm -M 10.187.70.223 -f 10.187.70.0
pntadm -M 10.187.70.222 -f 10.187.70.0
pntadm -M 10.187.70.216 -f 10.187.70.0
pntadm -M 10.187.70.214 -f 10.187.70.0
#

Hi.

It is missing -f 00
also ksh /tmp/doIt does not work.
Please help. Thank you.
 
Old 10-06-2009, 01:54 AM   #7
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
A pretty obvious fix:
Code:
pntadm -P 10.187.70.0 | nawk '$2 == "04" { printf("pntadm -M %s -f 00 %s\n",$3,$6); }' >/tmp/doIt
ksh /tmp/doIt
 
Old 10-06-2009, 06:10 AM   #8
rust8y
Member
 
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
Thanks jlliagre.
 
Old 10-06-2009, 05:58 PM   #9
rust8y
Member
 
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
pntadm -P 10.187.70.0 | nawk '$2 == "04" { printf("pntadm -M %s -f 00 %s\n",$3,$6); }' >/tmp/doIt
ksh /tmp/doIt

How do I schedule these commands as a cron job that runs at 3 am every day?
 
Old 10-07-2009, 04:49 AM   #10
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
There is nothing specific with these commands regarding crontab. Create a shell script and add it to root's crontab with proper scheduling.
 
Old 10-07-2009, 08:05 PM   #11
rust8y
Member
 
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
Is this syntax correct?

0 3 * * * pntadm -P 10.187.70.0 | nawk '$2 == "04" { printf("pntadm -M %s -f 00 %s\n",$3,$6); }' >/tmp/doIt; ksh /tmp/doIt
 
Old 10-08-2009, 02:09 AM   #12
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That's not what I suggested. You'd rather create a script (eg.: /opt/local/pntadm-fix.ksh ), make it executable (chmod +x pntadm-fix.ksh) and reference it in the crontab.
Code:
#!/bin/ksh
/usr/sbin/pntadm -P 10.187.70.0 | nawk '$2 == "04" { printf("/usr/sbin/pntadm -M %s -f 00 %s\n",$3,$6); }' >/tmp/doIt
ksh /tmp/doIt
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 12:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration