<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Thanks Noel and Andrew for your
suggested code. Unfortunately, both your suggestions are a little
beyond my comfort level when it comes to bash scripts and I have
decided to use the following approach:<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
if [ -n "$1" ]<br>
# Test whether command-line argument is present (non-empty).<br>
then<br>
..........use these rsync options<br>
else <br>
...........use these rsync options<br>
fi <br>
<br>
That lets me view the output or redirect it to log files (but not
both). However I don't really need to have both just one or the
other will do fine. I will run the cron job with no argument and
then run it with an argument from a terminal when required.<br>
<br>
Actually, the script already includes a few Kdialog GUI popup
messages reminding me to plug a USB backup drive, when errors
occur and when its finished successfully, so on a miserable winter
day when I am looking for a project I plan to re-write the whole
thing as a Python script or as a Qt4/C++ GUI with a KDE4 Plasma
panel notifier and if I get really bored I will add a Gnome
notifier, which should work in Cinnamon. I really do need to keep
my old brain active as I have written little code of late.<br>
<br>
John<br>
<br>
<br>
<br>
On 08/16/2014 11:36 PM, Noel Burton-Krahn wrote:<br>
</div>
<blockquote
cite="mid:CAB5uXS6Wfx+-7vE-qV5+xikP73CWJJZ2V=iA8qtZ37QB7Q1aLg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi John,
<div><br>
</div>
<div>I use 'tail -f' to save the output of a program and watch
it at the same time:</div>
<div><br>
</div>
<blockquote style="margin:0px 0px 0px
40px;border:none;padding:0px">
<div>
make >make.out 2>&1 & tail -F make.log</div>
</blockquote>
<div><br>
</div>
<div>Note, Ctrl-C will kill tail, not the make session above.
You have to kill make explicitly if you want to stop it:</div>
<div><br>
</div>
<div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>kill %-</div>
<div><br>
</div>
</blockquote>
</div>
<div><br>
</div>
<br>
Sometimes you make want to start a long running program and be
able to log in from time to time to see how it's doing. I start
it in a screen session:
<div>
<br>
</div>
<blockquote style="margin:0px 0px 0px
40px;border:none;padding:0px">
<div>
<div>screen -d -m -S myscreen tcpdump -veplni host</div>
</div>
</blockquote>
<div>
<div><br>
</div>
<div>Then later while it's running I can log in from a
different session and check up on it</div>
</div>
<div><br>
</div>
<blockquote style="margin:0px 0px 0px
40px;border:none;padding:0px">
<div>screen -dr myscreen</div>
<div><br>
</div>
</blockquote>
Or kill it:
<div><br>
</div>
<blockquote style="margin:0px 0px 0px
40px;border:none;padding:0px">
<div>screen -X -S myscreen quit</div>
</blockquote>
<div>
<div><br>
</div>
<div>HTH</div>
<div class="gmail_extra">
--</div>
<div class="gmail_extra">Noel</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Fri, Aug 15, 2014 at 3:24 PM,
John Blomfield <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:jabfield@shaw.ca"
target="_blank">jabfield@shaw.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Here
is a snippet from a bash script cron job I run:<br>
<br>
.............<br>
if rsync -avz --delete --exclude=lost+found $SOURCEDIR
$DESTDIR 1> $DEBUGLOG 2> $ERRORLOG; then \<br>
..........<br>
<br>
Occasionally, I need to run this script manually in a
terminal and would like to see the output in the
terminal as well as saving it to the debug and error log
files. Any suggestions?<span><font color="#888888"><br>
<br>
-- <br>
John Blomfield<br>
Delivered by Thunderbird Email on Linux
OpenSuse-KDE4<br>
<br>
Old John B's Linux Notes <a moz-do-not-send="true"
href="http://www.oldjohnbslinux.wordpress.com"
target="_blank">http://www.oldjohnbslinux.wordpress.com</a><br>
<br>
<br>
_______________________________________________<br>
Discuss mailing list<br>
<a moz-do-not-send="true"
href="mailto:Discuss@vlug.org" target="_blank">Discuss@vlug.org</a><br>
<a moz-do-not-send="true"
href="http://lists.vlug.org/mailman/listinfo/discuss"
target="_blank">http://lists.vlug.org/mailman/listinfo/discuss</a><br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
John Blomfield
Delivered by Thunderbird Email on Linux OpenSuse-KDE4
Old John B's Linux Notes <a class="moz-txt-link-freetext" href="http://www.oldjohnbslinux.wordpress.com">http://www.oldjohnbslinux.wordpress.com</a>
</pre>
</body>
</html>