after

Echo a string after process dies
git clone _git@git.zakaria.org/after.git
Log | Files | Refs | README | LICENSE

after.1 (1368B)


      1 .Dd $Mdocdate: January 5 2021 $
      2 .Dt AFTER 1
      3 .Os
      4 .Sh NAME
      5 .Nm after
      6 .Nd after process dies echo a string to standard output
      7 .Sh SYNOPSIS
      8 .Nm after
      9 .Op Fl h
     10 .Op Fl v
     11 .Op Fl p Ar pid | Fl n Ar program_name
     12 .Fl e Ar string
     13 .Sh DESCRIPTION
     14 .Nm
     15 watches the process list for the given
     16 .Ar pid
     17 or
     18 .Ar program_name .
     19 When the process is no longer in the process list
     20 .Nm
     21 outputs
     22 .Fl e Ar string
     23 to standard output.
     24 If both
     25 .Ar pid
     26 and
     27 .Ar program_name
     28 are specified
     29 .Nm
     30 will default to watching the process specified by
     31 .Ar program_name .
     32 
     33 In the case of using
     34 .Ar program_name
     35 if there are multiple programs with this name running all of them will have to
     36 exit before
     37 .Nm
     38 will echo
     39 .Ar string .
     40 .Sh OPTIONS
     41 .Bl -tag -width Ds
     42 .It Fl p Ar pid
     43 Watch
     44 .Ar pid .
     45 .It Fl n Ar program_name
     46 Watch
     47 .Ar program_name .
     48 .It Fl h
     49 Show usage information.
     50 .It Fl v
     51 Be verbose.
     52 .Sh EXAMPLES
     53 Following are some examples to illustrate how
     54 .Nm
     55 could be useful (or not).
     56 
     57 Notify when your compiler has finished running:
     58 .Bd -literal -offset indent
     59 $ after -n clang -e "build is finished!"
     60 .Ed
     61 .Pp
     62 The power of this simple tool can be observed when the output is piped into
     63 other programs. For instance; putting your machine to sleep after your update
     64 script has finished running:
     65 .Bd -literal -offset indent
     66 $ after -p 2027 -e "doas zzz" | sh
     67 .Ed
     68 .Sh SEE ALSO
     69 .Xr kvm_getprocs 3 ,
     70 .Xr kvm_open 3