How To Redirect The Output When We Are Usinf EOF In The Same Line?
need to login 4 systems to check whether the systems are accessible or not using rlogin command,after each login i will exit.After issuing the command rlogin abc if it is not responding i will get a message of "connection timed out" . So i want to automate this task .so i tried like below:
EX:
Code:
But how can i check if the system responds or not.
When i do
Code:
and the system throws an error
Code:
then i want it as notification through mail. else it should continue with the process.
Any help greatly helps me Linux
Moderator's Comments:
Please use CODE tags correctly as required by forum rules!
Last edited by RudiC; 12-04-2017 at 06:38 AM..
Reason: Added CODE tags.
Please be aware that rlogin is NOT today's tool of choice to connect to network nodes; you may want to consider secure tools, e.g. ssh, instead (if rlogin hasn't been aliased to ssh on your system anyhow, that is).
For error conditions as described you may want to check the command's exit code, either with an if construct:
or by evaluating the shell variable $?
IMMEDIATELY after the command was run.
EDIT: With your "here documents" (the data between EOF and EOF), the remote system will try to execute the lines as commands, and if 6 and n are not installed / aliased, you'll have error exit codes as well, although the nodes are readily available on the net.
need to login 4 systems to check whether the systems are accessible or not using rlogin command,after each login i will exit.After issuing the command rlogin abc if it is not responding i will get a message of "connection timed out" . So i want to automate this task .so i tried like below :
EX:... (1 Reply)
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)
I would like to redirect output of command line in for loop as $line.
Output should be processed as line but instead it throw whole output.
Could somebody help me on how to redirect output of command line and process it line by line without sending output to any file.
below is my code ... (1 Reply)
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)
I have a script:
#!/bin/ksh
runmqsc CERN.PROD <<EOF
dis chs(to.*)
end
EOF
which gives me the output as:
1 : dis chs(to.*)
AMQ8417: Display Channel Status details.
CHANNEL(TO.CGPRODAPP2) CHLTYPE(CLUSRCVR)
CONNAME(10.60.16.50) CURRENT
... (5 Replies)
Hi guys,
I have some echo scripts and awk scripts like these:
echo "some text" > output1
.
.
awk '{....}{print}' input > output2Both output1 and output2 are saved with unix END Of Line, then,
is there an option to include within echo command and awk command to save the output as DOS END Of... (3 Replies)
sed 's|^xyz.abc *= *.*|xyz.abc=60|' /test/myFile.properties > /test/myFile.properties1
myFile.properties has the last line as xyz.abc=23 does not end with newline.
When I run this command the last line is truncated if there is no newline character at EOF. Looking for an alternative here. (1 Reply)
Hello attempting to redirect out to create a startup script in solaris. The steps are working but the $1 entry is being left out. syntax below and content of output file below.
cat > S99build << EOF
> #!/bin/bash
> case $1 in
> 'start')
> /usr/os-buildsol.sh
>
> ;;
> esac
> exit 0
>... (3 Replies)
hello everyone...im having this problem with unexpected EOF with line 85 which is..i cant see whats wrong with it..can any1 plz help me out.
read -p "$p1 please enter the number of tries you wish to have:" lifeline
function main()
{
guessnum=0
read -p "Please... (6 Replies)