MU-VMS Archives

September 1997

MU-VMS@LISTSERV.MIAMIOH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Kent Covert <[log in to unmask]>
Reply To:
Miami University OpenVMS <[log in to unmask]>
Date:
Mon, 15 Sep 1997 07:41:38 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (65 lines)
In article <[log in to unmask]>, Ralph Goodpaster
 <[log in to unmask]> writes:
> How do I run a (noninteractive) process in the backgound?  I've tried
> various commands.  I use to use submit, but that seems to only work for
> simple DCL scripts.  I tried calling my program from such a script, but
> nothing appeared to happened and I never got any kind of notification
> about what happened.
 
If you use /KEEP/NOPRINT with the SUBMIT command, it will create a log
file in your account that should be the output of your program.  DCL
scripts running in BATCH mode have an implicit SET VERIFY command so that
all of the script is echoed to the log file as it's run.  That should help
you figure out what's not working.
 
Keep in mind that your LOGIN.COM file is run prior to the batch job.
Therefore, any mistakes there (like SET TERMINAL commands that don't make
sense in batch mode) may cause problems with your batch jobs.
 
> The OpenVMS books led me to believe that I could use spawn, but if I spawn
> it kinda gets stuck there... My process is running, but it isnt in the
> background and if I terminate connection it stops.
 
The SPAWN command will create a subprocess of your current process and run
a command within it.  The subprocess shares the same input and output as
your current terminal, though.  Therefore, a command like:
    $ SPAWN SHOW USERS/FULL
will be reflected to your screen.
 
By default, the process that issues the spawn will wait until the
subprocess finishs before continuing.  You can alter this by adding the
/NOWAIT qualifier.  This will truly put the process in the background.
 
You are correct in assuming that a spawned process ends when you log off,
though.  Since it's a subprocess of the process that creates it, it will
be stopped when the parent process dies.
 
Since suprocesses share the same input and output as the parent process,
interrupts such as Control-C are also sent to the subprocess. Therefore,
you may want to add a /INPUT=NL: to prevent all input from the parent to
the subprocess.
 
> So I'm at a loss here, can anyone tell how to run a compiled C program in
> the background when I'm not logged in?
 
You can also use RUN/DETACHED.  This will create a process that is truly
independent of the parent and will not die when the process issuing the
command ends.  This is the method that the system uses to create most of
it's ongoing processes.  The processes, BTW, don't show up when issuing a
SHOW USERS/FULL command.  They do show up in a SHOW SYSTEM command, though.
 
I urge you, though, to be considerate in your use of system resources and
to write your programs with efficiency in mind.  If I find a process
running in the background that is taking up considerable CPU time or other
resources that doesn't seem to have a useful purpose, I will not hesitate
to take action against it.  If you have a program that you plan on running
in the background, I'd please ask you to send me a copy to review before
you begin running it so that I can help you analyze the potential impact on
our systems.
 
--
                                     Kent Covert, Software Coordinator
                                     Miami Computing and Information Services
                                     Miami University, Oxford, OH
                                     [log in to unmask]

ATOM RSS1 RSS2