How to make a batch file to start program and close theoldwindow?

Arch Willingham arch at tuparks.com
Wed May 16 02:05:52 UTC 2007


Dang...tried that too but all it did was make a zero length file and then quit.

Arch


-----Original Message-----
From: fedora-list-bounces at redhat.com on behalf of Les
Sent: Tue 5/15/2007 8:20 PM
To: For users of Fedora
Subject: RE: How to make a batch file to start program and close theoldwindow?
 
On Tue, 2007-05-15 at 14:34 -0400, Arch Willingham wrote:
> I tried that. After I did it, when you dbl click on the file, you see a screen flash by very quickly and then it disappears. I looked at the running processes and rdesktop is not running a running process (I'm from the Windows world and what I just typed may be barking up the wrong tree...I just took a SWAG and assumed if it was running t=in the background I would still see rdesktop running but Linux may not work that way).
> 
> Arch
> 
> -----Original Message-----
> From: fedora-list-bounces at redhat.com
> [mailto:fedora-list-bounces at redhat.com]On Behalf Of Mikkel L. Ellertson
> Sent: Tuesday, May 15, 2007 12:21 PM
> To: For users of Fedora
> Subject: Re: How to make a batch file to start program and close the
> oldwindow?
> 
> 
> Arch Willingham wrote:
> > I made a Linux (FC7) batch file that starts a terminal server
> > session. The batch file (called termserv.sh) contains these lines:
> > 
> > ------------------
> > #!/bin/bash
> > #######
> > rdesktop -P -f -u billybob our.computer.com -r printer:"printer4=HP Officejet 5600 series"
> > ------------------
> > 
> > The kicker is is that the black terminal window stays open. Is
> > there some command in the batch file that, in essence, just
> > starts/runs the other process and then lets the back box close?
> > 
> > Thanks!
> > 
> > Arch 
> > 
> I suspect that the shell is waiting for the rdesktop command to
> exit. You can try putting a & at the end of hte command and see if
> that does what you are after.
> 
> Mikkel
> -- 
> 
>   Do not meddle in the affairs of dragons,
> for thou art crunchy and taste good with Ketchup!

When you background a task with &, and then close the window, if the
task expects to have output, even for mundane messages, it will crash.
I know this from experience.  However, one workaround I have used is to
route the output to a file something like:

        #!/bin/bash
    #######
    rdesktop -P -f -u billybob our.computer.com -r printer:"printer4=HP
Officejet 5600 series"> temp.log &
       exit

    However, in some cases, depending on the shell program code, it will
redact all existing child processes, and free all memory on exit.  I am
not yet familiar enough with bash (old csh guy here) to know how bash
handles background processes.  Maybe man or info on bash can help you
out.  You might also google this question about bash to see if someone
has a real working example already done.

Regards,
Les H

-- 
fedora-list mailing list
fedora-list at redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4250 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070515/05375623/attachment-0001.bin>


More information about the fedora-list mailing list