home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / unix_c / utils / batch.sh < prev    next >
Encoding:
Text File  |  1989-03-21  |  1.9 KB  |  51 lines

  1. 10-Dec-85 04:19:35-MST,1975;000000000001
  2. Return-Path: <unix-sources-request@BRL.ARPA>
  3. Received: from BRL-TGR.ARPA by SIMTEL20.ARPA with TCP; Tue 10 Dec 85 04:19:30-MST
  4. Received: from usenet by TGR.BRL.ARPA id a023483; 10 Dec 85 5:43 EST
  5. From: garcia <amg22@aluxz.uucp>
  6. Newsgroups: net.sources,net.micro.att
  7. Subject: batch command for AT&T UNIX PC 7300
  8. Message-ID: <287@aluxz.UUCP>
  9. Date: 9 Dec 85 18:12:43 GMT
  10. Xref: seismo net.sources:4005 net.micro.att:795
  11. To:       unix-sources@BRL-TGR.ARPA
  12.  
  13.  
  14.  
  15.     I ran across the following shell script which does a nice job
  16. of providing the much missed batch command on the AT&T UNIX PC.  The
  17. original file (below the cut line) is pretty much self explanatory.
  18.  
  19.     I hope others find it as useful as I do.  I would also be
  20. interested in any feedback on this file or the availability of other
  21. goodies for the PC 7300.
  22.  
  23.             Gus Garcia
  24.             AT&T Bell Laboratories
  25.             555 Union Blvd
  26.             Allentown, PA  18103
  27.  
  28.             aluxz!amg22
  29.  
  30. ------------------------- Cut along this line -------------------------
  31. #........................................................................
  32. #:                                    :
  33. #: batch -- Run a background shell script independent of login status.    :
  34. #:    Copyright 1985 by G.R.A.M. Associates - For the Public Domain    :
  35. #:                                    :
  36. #:    Usage:    batch [-] [file ...]                    :
  37. #:        where:    file    is 0 or more files containing shell    :
  38. #:                scripts                 :
  39. #:            -     indicates standard input.        :
  40. #:                                    :
  41. #:    Files:    $HOME/mmddhhmmss (temporary file removed after use)    :
  42. #:                                    :
  43. #:  G.R.A.M. Associates assumes no responsibility for any use or misuse    :
  44. #: of this program.  Please don't remove this header.            :
  45. #:......................................................................:
  46.  
  47. FILE=$HOME/`date '+%m%d%H%M%S'`        # Make a unique file name
  48. ( cat $* ; echo rm -f $FILE ) > $FILE    # Need a separate process for input
  49. nohup sh -c "sh $FILE 2>&1 | mail $LOGNAME" 2>&1 >/dev/null &    # Run it
  50. echo batch: Executing $FILE        # Let 'em know its running
  51.