I'm very new to unix shell scripting. Im also new here in this forum. I'm a SQL Server DBA but I'm slowly learning Oracle and Sybase DB. Our Oracle and Sybase are on Unix platforms. Im slowly learning Linux Admin and Shell Scripting to automate tasks.
I'm writing a script to view DB error logs. I'd like my script to ask me how many lines from the logs do I want to read and if I want to grep a word.
I use the if..else construct. the command after the "if" is working but after the "else", if blank, I just want my script to ignore the "grep"
--Error:
Moderator's Comments:
Please use CODE tags when displaying sample input, output, and code segments.
Last edited by Don Cragun; 08-01-2017 at 03:52 AM..
I'm very new to unix shell scripting. Im also new here in this forum. I'm a SQL Server DBA but I'm slowly learning Oracle and Sybase DB. Our Oracle and Sybase are on Unix platforms. Im slowly learning Linux Admin and Shell Scripting to automate tasks.
I'm writing a script to view DB error logs. I'd like my script to ask me how many lines from the logs do I want to read and if I want to grep a word.
I use the if..else construct. the command after the "if" is working but after the "else", if blank, I just want my script to ignore the "grep"
--Error:
Moderator's Comments:
Please use CODE tags when displaying sample input, output, and code segments.
Hi Ricky777,
Please get into the habit of telling us what operating system and shell you're using when asking questions about shell scripts. Different shells (and, for some features, different versions of shells) behave differently.
Assuming that you're using a shell based on Bourne shell syntax, the = operator in the test command (as in [ string1 = string2 ]) has to be separated from the two strings being compared by space or tab characters. When all three operands are presented as one word, the test command just tests whether that single word in an empty string (which yields a false result) or a non-empty string (which yields a true result). Furthermore, what you want to know is whether the expansion of the variable $word is not an empty string; not whether the expansion is the string word. And, when expanding a variable that might include spaces or special characters (i.e., any user supplied input) you need to quote the expansion so the command invoked with that expansion will see the expansion as a single word.
I have a script
#!/bin/bash
HOST=ftp.example.com
USER=ftpuser
PASSWORD=P@ssw0rd
ftp -inv $HOST <<EOF
user $USER $PASSWORD
cd /path/to/file
mput *.html
bye
EOF
the script executes sucessfully I need to capture the FTP logs to a logfile
should contain
FTP Login successful
... (1 Reply)
Hi,
I need write a shell script which should be executed from the crontab every day.
This shell script is running several other shell scripts , and each one of them is writing to its log file.
Few of the the shell script are also connecting using ssh to some other users on remote machine , do... (1 Reply)
Does anyone know if there is software written to view the audit logs generated by Solaris? I am referring the the logs created by auditd. It produces an unreadable log. I am familiar with auditreduce and praudit, but I am looking for something that produces a report, much like logwatch looks at the... (4 Replies)
Hi,
I have a strange situation here, I want to archive gc.logs file, generated by a java application, the strange thing about gc.log file is is doesn't have any time/date stamp appended to it unlike other logs (catalina/access/error) and one more strange thing is when ever the application is... (6 Replies)
Hi,
I want to know how we can view two or three logs which are dynamically getting updated from a single/same putty window with tail commnad.
Thanks. (7 Replies)
Hi !
I have a FTP site, where I softlinked my server log file.
Now I want to view the logs in IE as I do in unix
Some kind of free tool should be there, Can somebody provide me a pointer.
Thanks. (0 Replies)
Please share a shell script to collect logs of a server (like cpu utilization, memory etc) for a perticular time interval by giving date, time and server name as input. (1 Reply)
Hello
one of my sites i host is doing somewhat well in the search engines, and i would like to watch the raw log files while looged in with telenet
is there a way to do this.
thanx
Mike (2 Replies)