How do I unset TXTBSY on a daemon's binary?

Leslie Mikesell les at chinet.chi.il.us
Sun May 12 07:38:16 AEST 1991


In article <1991May10.042300.5901 at massey.ac.nz> A.Raman at massey.ac.nz (A.V.Raman) writes:

>1. What is the accepted procedure to unset the TXTBSY flag on the binary
>   after the daemon backgrounds itself?

Just mv it to a different name on the same filesystem so you can replace
it with the new version.  Later you can rm the old version.  If the
program is being frequently executed, arranging to mv the old copy
to another directory that is later in the PATH of the users will insure
that either the old or new copy will be executable at all times.

>2. How do I find out if a particular user is logged on from within a C
>   program.

>I need to do (2) because I want to find out whether I must write a 
>user or mail him regarding some status change he required.  I tried doing
>a man -k on "user", "wtmp", "logg" etc., but none gives me any info about
>a C library function / System call that tells me whether a particular user
>is logged on.

If the notification is important, I'd mail it in all cases.  Just being
logged in does not insure that you will see a "write" message.  But
why not just execute write and let it fail if the user isn't logged
in?  You have to be prepared for failure anyway, since the user might
log out between your test and the execution of write - why do you
need any other test?.

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.questions mailing list