Re: parallel bash scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/27/2012 04:06 PM, bruce wrote:
dave..

thanks.

but the script is a long running script, and i want to see the output
as the script is running without having to hit the keyboard..

so doing a tail of the file while the process is running isn't what
i'm looking for.

anything else?

The problem is that a script wants a stdin, stdout and stderr. If
you're going to run them in parallel, you can't very well have both
scripts outputting to the terminal.

The correct thing is to do what Dave said. Use nohup and redirect stdout
and stderr to a log file. You can then "tail -f" each one whenever you
want. An alternative is to launch the scripts in detached screen
sessions:

	screen -d -m dog.sh
	screen -d -m cat.sh

This would launch each script in its own detached screen session
(essentially creates virtual terminals with shells and runs the script
in them) and the calling script doesn't wait for them to complete.

You can then "screen -r <id>" to attach to those screen sessions. You
can get the list of screen sessions running simply by doing "screen -r"
without specifying a session ID. Use "ctrl-A, ctrl-D" to detach from
a screen session (but leave it running). See "man screen" for details.

Oh, yeah, you may need to "yum install screen" if you don't already have
it.

On Tue, Mar 27, 2012 at 7:00 PM, Dave Ihnat<dihnat@xxxxxxxxxx>  wrote:
On Tue, Mar 27, 2012 at 06:06:56PM -0400, bruce wrote:
anyway i can redirect the err/out to the stdout.. instead of the
nohut.out file??

The usual way would be to do a tail -f on the output file, e.g.,

 nohup cat.sh 2>&1>cat.log
 tail -f cat.log

If you're using bash, IIRC, you could reap the background ID and then use
'disown', I suppose. Â "$!" should give you that.

Cheers,
--
       Dave Ihnat
       President, DMINET Consulting, Inc.
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


--
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-      We are born naked, wet and hungry. Then things get worse.     -
----------------------------------------------------------------------
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux