From owner-freebsd-questions Mon Mar 17 13:20:53 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9064737B405 for ; Mon, 17 Mar 2003 13:20:50 -0800 (PST) Received: from gatekeeper.microcell.ca (gatekeeper.microcell.ca [205.151.8.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB67443F93 for ; Mon, 17 Mar 2003 13:20:48 -0800 (PST) (envelope-from SoHo@admin.fido.ca) Received: from mailserv.microcell.ca (mailserv.microcell.ca [10.2.0.87]) by gatekeeper.microcell.ca (Postfix) with ESMTP id 9411D16CB8; Mon, 17 Mar 2003 16:20:47 -0500 (EST) Received: from 127.0.0.1 (localhost [127.0.0.1]) by mailserv.microcell.ca (Postfix) with SMTP id 54F7716BC9; Mon, 17 Mar 2003 16:20:47 -0500 (EST) Received: from lenard.admin.fido.ca (lamus.fido.ca [10.0.1.45]) by mailserv.microcell.ca (Postfix) with ESMTP id 738A316BC9; Mon, 17 Mar 2003 16:20:46 -0500 (EST) Received: from magni.microcell.ca (magni.microcell.ca [10.6.22.102]) by lenard.admin.fido.ca (SMTP_Gateway) with ESMTP id 5140F47D3C; Mon, 17 Mar 2003 16:20:46 -0500 (EST) Received: from magni.microcell.ca (localhost [127.0.0.1]) by magni.microcell.ca (8.12.6/8.12.7) with SMTP id h2HLJOfa088527; Mon, 17 Mar 2003 16:19:24 -0500 (EST) (envelope-from SoHo@admin.fido.ca) Date: Mon, 17 Mar 2003 16:19:24 -0500 From: Edmond Baroud To: "Chris Phillips" Cc: questions@freebsd.org Subject: Re: Pushing commands to the background Message-Id: <20030317161924.38b93d43.SoHo@admin.fido.ca> In-Reply-To: <004001c2ecc9$6cd20500$1508060a@furrie.net> References: <004001c2ecc9$6cd20500$1508060a@furrie.net> X-Mailer: Sylpheed version 0.8.10 (GTK+ 1.2.10; i386-portbld-freebsd4.7) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Sanitizer: This message has been sanitized! X-Sanitizer-Rev: $Id: Sanitizer.pm,v 1.64 2002/10/22 16:37:04 bre Exp $ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG hi On Mon, 17 Mar 2003 21:08:57 -0000 "Chris Phillips" wrote: > Hello all, > > I'm not sure if it's exactly "On Topic" (I bet you'll let me know!), but > here goes... > > I work in technical support, for a FreeBSD based, Internet Appliance & > am after a way to gather some network quality information. > > I'd like to run some commands, one after another, have the output(s) > added (appended) to a file, then, when all is complete, have that file > sent to my email address. I can then compile the data & make some sense > of it, maybe... > > Stuff like: - > > hostname > uptime > ping -c 100 ftp.furrie.net > traceroute ftp.furrie.net copy this and put it in myscript.sh: #!/bin/sh hostname > /tmp/myscript.$$ uptime >> /tmp/myscript.$$ ping -c 100 ftp.furrie.net >> /tmp/myscript.$$ traceroute ftp.furrie.net >> /tmp/myscript.$$ mail -s "myscript's output" yourmail@domain.com rm /tmp/myscript.$$ chmod u+x myscript.sh /myscript.sh & (will do give you the command prompt back, it's the ping -c 100 that was keeping u from getting back to the prompt, u had to wait until it finishes the "-c count") Ed. > > I'd like to push all the commands into the background & be able to log > off and let it do its business unattended. Unfortunately, with my > lacking knowledge, so far I have managed this, (sad isn't it)... > > (ping -c 10 ftp.furrie.net > /tmp/results && cat /tmp/results | mail > chris@furrie.net &) > > Even with an & at the end of this command, I do not get my prompt back > :-( > > Please can somebody help me? Even if it's just to give me another place > to ask my question... > > Many Thanks Everyone! > > > Chris Phillips > > PS. I often write emails to FreeBSD-Questions@FreeBSD.Org, but rarely > send them, as I read my questions before sending & often find much > better results when googling with my questions. > > > intY has scanned this email for all known viruses (www.inty.com) > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- Edmond Baroud UNIX Systems Admin mailto:SoHo@admin.fido.ca Fingerprint 140F 5FD5 3FDD 45D9 226D 9602 8C3D EAFB 4E19 BEF9 "UNIX is very user friendly, it's just picky about who its friends are." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message