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
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
09-30-2009, 01:21 AM
#1
Member
Registered: May 2006
Posts: 100
Rep:
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?
10-01-2009, 12:57 AM
#2
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Please provide more details about what pntadm outputs and what xx should be replaced with.
10-02-2009, 04:17 AM
#3
Member
Registered: May 2006
Posts: 100
Original Poster
Rep:
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
#
10-02-2009, 04:38 AM
#4
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
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.
10-03-2009, 09:24 AM
#5
Member
Registered: May 2006
Posts: 100
Original Poster
Rep:
Many thanks
10-05-2009, 05:57 PM
#6
Member
Registered: May 2006
Posts: 100
Original Poster
Rep:
# 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.
10-06-2009, 01:54 AM
#7
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
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
10-06-2009, 06:10 AM
#8
Member
Registered: May 2006
Posts: 100
Original Poster
Rep:
Thanks jlliagre.
10-06-2009, 05:58 PM
#9
Member
Registered: May 2006
Posts: 100
Original Poster
Rep:
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?
10-07-2009, 04:49 AM
#10
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
There is nothing specific with these commands regarding crontab. Create a shell script and add it to root's crontab with proper scheduling.
10-07-2009, 08:05 PM
#11
Member
Registered: May 2006
Posts: 100
Original Poster
Rep:
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
10-08-2009, 02:09 AM
#12
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
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
All times are GMT -5. The time now is 12:26 PM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News