Doing job-control on you own ?

Doing job-control on you own ?

Post by Ole Nomann Thoms » Sun, 07 Oct 1990 01:48:47



Hello All.

I am trying to write a small shell-like program, that will enable me
to simulate a limited form of job-control on a system that hasn't got
it. (SCO Xenix rel. 2.3.2).

What I have in mind is this:

$ co-start prog1 prog2

Now, prog1 is active, until you generate some signal, at which
point prog1 is suspended, and prog2 starts up (and so on). To simplify
things, I will avoid detaching the suspended process from the terminal
and stuff like that.

My idea was something like this:

main()
{
        signal(SOMESIGNAL, switch);
        /* SOMESIGNAL should be something the keyboard could generate */

        if (fork() == 0) exec ("Prog1");
        if (fork() == 0) exec ("Prog2");

        /* do something else */

Quote:}

switch()
{
        static int flag;

        if (flag == MYTURN) {
                flag = NOTMYTURN;
                resume; /* probably some longjump */
        } else {
                flag = MYTURN;
                sleep (INFINITE);
        }

Quote:}

But then I realised: "Hey, the signal(SOMESIGNAL, switch) will never
survive the exec!", and I got stuck.

Isn't there some way of doing this, even when you <som'thing>IX
doesn't support job control? Or have I just asked for the impossible?

I would really appriciate help, ranging from: "You misused fork()" to:
"Ah, what you need is probably this: <CODE> Have fun.", or perhaps even:
"This is impossible because of <REASON>, you poor ignorant soul.".

Standard nettiquette applies: Please E-mail, and I'll post a summary.


"Information is not knowledge" - Frank Zappa.

 
 
 

1. bash job control: re-own?

I have seen how I can ^Z and bg and disown a job.  But how do I (if it is
even possible) adopt an orphaned job from a new console later?

I would like to be able to start a job via ssh, put it in the background,
disown it, logout, login later and re-own it to see its progress.

Any way to do this?

--Eric

2. Tell Netscape you want a Dynamic Motif

3. problems on job-control of csh

4. Modem won't fire up -- Newbie

5. JOB CONTROL FOR JOBS w/o a TTY (using BASH)?

6. xlib Connection Refused???

7. what shell do I have? job-control

8. Iptables and external users

9. Jobs, Jobs, Jobs And More Jobs!!!