From owner-freebsd-questions Mon Mar 17 13:19: 1 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 B838937B401 for ; Mon, 17 Mar 2003 13:18:58 -0800 (PST) Received: from diana.northnetworks.ca (att-ws20.switchview.com [216.13.70.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id D425943FA3 for ; Mon, 17 Mar 2003 13:18:57 -0800 (PST) (envelope-from iaccounts@northnetworks.ca) Received: from diana.northnetworks.ca (localhost.northnetworks.ca [127.0.0.1]) by diana.northnetworks.ca (8.12.8/8.11.6) with ESMTP id h2HLIvhN030864; Mon, 17 Mar 2003 16:18:57 -0500 (EST) (envelope-from iaccounts@northnetworks.ca) Received: from localhost (iaccounts@localhost) by diana.northnetworks.ca (8.12.8/8.12.8/Submit) with ESMTP id h2HLIvO1030861; Mon, 17 Mar 2003 16:18:57 -0500 (EST) X-Authentication-Warning: diana.northnetworks.ca: iaccounts owned process doing -bs Date: Mon, 17 Mar 2003 16:18:56 -0500 (EST) From: Steve Bertrand To: Chris Phillips Cc: FreeBSD-Questions@FreeBSD.ORG Subject: Re: Pushing commands to the background In-Reply-To: <004001c2ecc9$6cd20500$1508060a@furrie.net> Message-ID: <20030317161434.O27870-100000@diana.northnetworks.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 > 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 without testing, try something like this: # hosname > outputfil && uptime >> outputfil && \ ping -c ftp.furrie.net >> outputfil && \ traceroute ftp.furrie.net >> outputfil && \ mail -s "myoutput" myaddr@mydomain.com < outputfil && \ rm outputfil & The single & pushes the command to the background and the double & is an AND operator, telling the system to run one command AND then this one AND then this one etc. This is one command, ignore the \. Just type it out as one string. Hope this works! Steve > > 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 > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message