Help

Help

Post by Al » Tue, 30 Apr 2002 14:58:48



Hi,
    I am  trying to synchronise the NIS passwd list with all the apache
servers' .htaccess files. So for that I have a crontab running every 30 mins
to see if any NIS passwd is changed and if some passwd changes , all the
apache servers change the passwd in the .htaccess too. Is there any better
way of doing it apart from synchronizing? How do I allow the users to change
the NIS users online so that the change is reflected on all the systems?

Anyways as of now , I am using a script that I am not happy with.

I take the output of `ypcat passwd` and use 'sed -e "s/://" and awk print
$1,$2 to a file ( that is just the logins and passwd) and insert the colon
in the space between them again. Then I rcp it to all the servers. I'm sure
I can do it in one go, how do I just delete all the other colon stuff with
just the login:passwd.

For Example , if there's an entry like
bern:IVRsGA7auT56s:11062:10:Bernard Shaw:/user/bern:bin/ksh

then I replace ':' with '' (blank) and then awk $1 and $2 ie...
bern IVRsGA7auT56s and again replce '' with ':'

How do I directly get this stuff in a one liner?

TIA,
-Al

 
 
 

Help

Post by Bill Marc » Tue, 30 Apr 2002 17:08:20


On Mon, 29 Apr 2002 11:28:48 +0530,
e
Quote:>I can do it in one go, how do I just delete all the other colon stuff with
>just the login:passwd.

>For Example , if there's an entry like
>bern:IVRsGA7auT56s:11062:10:Bernard Shaw:/user/bern:bin/ksh

>then I replace ':' with '' (blank) and then awk $1 and $2 ie...
>bern IVRsGA7auT56s and again replce '' with ':'

>How do I directly get this stuff in a one liner?

awk -F: 'BEGIN{OFS=FS} {print $1,$2}'

 
 
 

Help

Post by Peter Booste » Tue, 30 Apr 2002 17:20:22



Quote:> Hi,
>     I am  trying to synchronise the NIS passwd list with all the apache
> servers' .htaccess files. So for that I have a crontab running every 30 mins
> to see if any NIS passwd is changed and if some passwd changes , all the
> apache servers change the passwd in the .htaccess too. Is there any better
> way of doing it apart from synchronizing? How do I allow the users to change
> the NIS users online so that the change is reflected on all the systems?

> Anyways as of now , I am using a script that I am not happy with.

> I take the output of `ypcat passwd` and use 'sed -e "s/://" and awk print
> $1,$2 to a file ( that is just the logins and passwd) and insert the colon
> in the space between them again. Then I rcp it to all the servers. I'm sure
> I can do it in one go, how do I just delete all the other colon stuff with
> just the login:passwd.

> For Example , if there's an entry like
> bern:IVRsGA7auT56s:11062:10:Bernard Shaw:/user/bern:bin/ksh

> then I replace ':' with '' (blank) and then awk $1 and $2 ie...
> bern IVRsGA7auT56s and again replce '' with ':'

> How do I directly get this stuff in a one liner?

Euhmmm, how about:

awk -F: '{print $1":"$2}'

Peter
--
It never hurts to help - Eek! the Cat.

 
 
 

Help

Post by laura fairhe » Wed, 01 May 2002 03:38:12



>Hi,
>    I am  trying to synchronise the NIS passwd list with all the apache
>servers' .htaccess files. So for that I have a crontab running every 30 mins
>to see if any NIS passwd is changed and if some passwd changes , all the
>apache servers change the passwd in the .htaccess too. Is there any better
>way of doing it apart from synchronizing? How do I allow the users to change
>the NIS users online so that the change is reflected on all the systems?

>Anyways as of now , I am using a script that I am not happy with.

>I take the output of `ypcat passwd` and use 'sed -e "s/://" and awk print
>$1,$2 to a file ( that is just the logins and passwd) and insert the colon
>in the space between them again. Then I rcp it to all the servers. I'm sure
>I can do it in one go, how do I just delete all the other colon stuff with
>just the login:passwd.

>For Example , if there's an entry like
>bern:IVRsGA7auT56s:11062:10:Bernard Shaw:/user/bern:bin/ksh

>then I replace ':' with '' (blank) and then awk $1 and $2 ie...
>bern IVRsGA7auT56s and again replce '' with ':'

>How do I directly get this stuff in a one liner?

Use 'cut';

cut -d: -f1-2

Quote:>TIA,
>-Al

byefrom

--

                # if you are bored crack my sig.
1F8B0808CABB793C0000666667002D8E410E83300C04EF91F2877D00CA138A7A
EAA98F30C494480157B623C4EF1B508FDED1CEFA9152A23DE35D661593C5318E
630C313CD701BE92E390563326EE17A3CA818F5266E4C2461547F1F5267659CA
8EE2092F76C329ED02CA430C5373CC62FF94BAC6210B36D9F9BC4AB53378D978
80F2978A1A6E5D6F5133B67B6113178DC1059526698AFE5C17A5187E7D930492