Hi,
I am new to shell scripting and have a question. I would like to redirect the output of a command to multiple files, each file holding the exact same copy. From what I read from the bash manpage and from some searching it seems it cannot be done within the shell except setting up a loop. Is... (3 Replies)
Hi, I use this function (now modified with elif) for check if a pc is up: check_pc() {
$PING $PC 1 2> /dev/null
if ; then
check_dir #Other function
echo "Begin backup operation for $PC"
echo "$SMBTAR -s $PC -u $USER -p $PASS -x $SHARE$EXCL -t - | gzip -c >... (3 Replies)
Hello,
I have a java program which i am calling in shell script. I wanted to redirect output to 2 differetn files. Output should have both 1 & 2 (normal and error) in both file.
pls help (2 Replies)
Hi
There are many posts in this forum regarding reditecting output, but mine is a different problem, please have a look.
My shell script is redirecting output to a log file dynamically. That is it is using -
exec > log1.txt 2>&1
Hence all the traces are appearing in the log1.txt.
I want... (3 Replies)
I'm writing a script using file descriptor 2 (std error) to send an email only if the command fails or errors out but the script always emails me irrepective of whether it fails or not. It will not email the /tmp/check.error file output if doesn't error out just the mail with the subject "Cannot... (3 Replies)
Hi everyone, While I was trying to do
DATE=`date +"%Y%m%d_%H%M%S"`
STARTLOG=$TUXSTDDIR/start_$DATE.log
tmboot -y > $STARTLOG 2>&1
I got an error i.e. Ambiguous output redirect error. Here the first part is to boot the account so there is nothing wrong with that.... (6 Replies)
How to redirect the output to multiple files without putting on console
I tried tee but it writes to STDOUT , which I do not want.
Test.sh
------------------
#!/bin/ksh
echo "Hello " tee -a file1 file2
----------------------------
$>./Test.sh
$>
Expected output:
-------------------... (2 Replies)
Hi,
I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help );
#!/bin/bash
#... (16 Replies)
Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions.
... (4 Replies)
Hi Guys,
I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts.
I used below but it is not working:
OFILE=/home/home1/report1
echo "report1 details" > $OFILE
=/home/home1/1.sh > $OFILE
echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies
LEARN ABOUT DEBIAN
tryto
tryto(1) General Commands Manual tryto(1)NAME
tryto - tries to run a command limited by a timeout or number of tries, can be used to run as svlogd(8) processor.
SYNOPSIS
tryto [-pPv] [-t sec] [-k ksec] [-n tries] prog
DESCRIPTION
prog consist of one or more arguments.
tryto runs and watches prog, feeding its standard input to prog's standard input. If prog exits with a return code other then 0, tryto
runs prog again after sleeping one second.
If the number of retries reaches the maximal number of tries, tryto prints an error message and gives up.
If the timeout sec seconds is reached and prog is still running, tryto sends a TERM signal to prog, waits ksec seconds for prog to termi-
nate, then sends a KILL signal if prog still is there, and exits as soon as possible.
OPTIONS -t sec timeout. Set the timeout to send TERM to prog to sec seconds. Default is 180.
-k ksec
kill timeout. Set the timeout to send KILL to prog to ksec seconds. Default is 5.
-n tries
Set the maximal number of tries to tries. If prog exited with a return code other that 0, tryto tries to rewind standard input to
the beginning using lseek(2) before starting prog again. Default is 5.
-p processor. Use this option if you run tryto as a svlogd(8) processor (see below).
-P process group. Run prog in a new session and process group, and send signals on timeout to prog's process group instead of its pid.
-v verbose. Print verbose messages to standard error.
PROCESSOR
If tryto sees the -p option, tryto runs as a svlogd(8) or multilog(8) processor, making use of filedescriptors 4 and 5:
Before starting prog, tryto moves the filedescriptor 5 to 2, so all error messages from tryto and prog will be saved in svlogd(8)'s state
to be processed on the next run of tryto -p.
After starting prog, tryto first feeds all data it reads from filedescriptor 4 into prog's standard input, then all data from filedescrip-
tor 0.
If prog fails by timeout sec seconds or maximal number of tries, tryto prints all data from standard input to standard output, an error
message to standard error, and exits with 0.
EXIT CODES
If tryto itself fails, it returns 111.
If tryto runs as a svlogd(8) processor, tryto returns 0 in all other cases.
If prog was run successfully, tryto returns 0.
If prog failed by timeout, tryto returns 100.
If prog failed by maximal number of tries, tryto returns the last return code from prog.
SEE ALSO socklog(8), uncat(1), svlogd(8), multilog(8), lseek(2)
http://smarden.org/socklog/
http://smarden.org/runit/
AUTHOR
Gerrit Pape <pape@smarden.org>
tryto(1)