Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Removing deleted users from HylaFAX control files



Hi, 

I've found "ed", the line editor on which "vi" is based, useful for
"in-line" editing of text files. Try a script like this:-

#!/bin/bash
ed $1 <<EOF
g/^$2:/d
w
q
EOF


where $1 is the file to be edited and $2 the uid to delete.


I use variants of this to trim files such as /var/log/messages which are
usually open. If you use sed on an open file, save the output to a temp
file and copy back over the original, you'll find that it doesn't do the
biz until all processes using the original close it. They'll just keep
writing to the (invisible) inode, which will be unlinked when closed.

Now that's got to be the worst description of a procedure I've ever
written, but you get the picture...

Best Regards,

Mark Wilson

P. Kay Associates Ltd.


On Tue, 22 Aug 2000 KAbrahamsen@wrightgroup.com wrote:

> Hopefully this is an easy Q.
> 
> When we delete a Unix user, I'd like to also automatically delete their line
> in the HylaFAX 'hosts' file.
> I can do this either with 'grep' or 'sed' but since both of these commands
> would need to use a temporary file, would there be a problem with HylaFAX
> with due to the INODE change if I *mv'd* the temporary file back to the
> original file (and avoid needing to remove the 'tmp' file too)??? I could
> merely copy the 'tmp' file back over the original file so the INODE did not
> change but actually wondered about any INODE change (in general) with
> HylaFAX files.
> 
> Something like:
> # Remove HylaFAX hosts file entry
> sed '/^$userid:/d' "$faxfilespath/hosts" > "$faxfilespath/hosts.tmp"
> 
> mv -f "$faxfilespath/hosts.tmp" "$faxfilespath/hosts"
> OR
> cp -fp  "$faxfilespath/hosts.tmp" "$faxfilespath/hosts" 
> rm -f "$faxfilespath/hosts.tmp"
> 
> Thanks!
> ken
> 
> Kenneth Abrahamsen
> 425-806-3369 - Voice
> 425-486-7868 - FAX
> kabrahamsen@wrightgroup.com
> 
> 
> 
> ____________________ HylaFAX(tm) Users Mailing List _______________________
>  To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
> 



____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services