Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Mar 2003 16:19:24 -0500
From:      Edmond Baroud <SoHo@admin.fido.ca>
To:        "Chris Phillips" <Chris@furrie.net>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
hi

On Mon, 17 Mar 2003 21:08:57 -0000
"Chris Phillips" <Chris@furrie.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030317161924.38b93d43.SoHo>