I'm new at Unix. I am tasked to monitor the filesystem utilization on OS level (Unix) and DB (Sybase) for multiple systems. I am thinking to use vi editor and make a file, execute that file and all the file systems I need to monitor will be be shown.
My script inside vi goes in this flow.
When executing above script, it does load filesystem in OS level (the df -h one) and accesses su - sybsid line however don't automatically enter isql.
seems like it stuck on su - sybsid line. When i execute "exit" in sybsid i get this error "isql: command not found".
Hope you could help me out with my script to automate my monitoring for multiple systems..
Thank you very much.
Moderator's Comments:
Please use code tags as required by forum rules!
Last edited by RudiC; 06-11-2016 at 05:43 AM..
Reason: Added code tags
That looks like a misunderstanding followed by a flawed setup and/or security issue.
su - sybsid will create an interactive session for user sybsid, and you should see - without mentioning it above - that user's prompt sitting and waiting for your input. You entering "exit" will end the session. Did you consider su's -c option?
Then, the former user, whoever that might be, tries to run isql, resulting in command not found. That can be on purpose: user is not intended to run it, or it is a missing/wrong PATH and/or alias definition.
I hope I could point you in the right direction to solve your problem.
Thanks for your reply, sorry to get you confused. Reason why i execute "exit" on su - sybsid line is to just get any response or error in my script as to why it does not execute the isql line.
Is the su - sybsid line really interactive? Meaning i really should execute isql line everytime i run the file in order for my script to continue? I was thinking of eliminating any interaction so it does save me time as i need to do these on multiple systems.
Thanks a lot! That worked perfectly.
however this time my script for monitoring DB file system utilization is the new problem. when i enter isql, i just simply paste the "long script" (when i do this manually) but this time it's not executing automatically. Seems vi is still reading it as Unix script whereas should be in isql.
any advise on this?
---------- Post updated at 08:16 PM ---------- Previous update was at 07:25 PM ----------
Hi RudiC
I solved my issue above, just echo the whole 'long script'. My problem is now solved.
Let's get some terms right, as from reading your post I get the feeling not all is crystal clear to you:
df -h does not "load filesystem in OS level", it "... displays the amount of disk space available on the file system ...". A look at man df might help.
vi is one among many text editors. It does not execute scripts nor programs but allows you to create and modify text files. These, if consisting of commands and shell builtins, are known as scripts and, if having the "executable" permission set, can be executed (better: interpreted) by the shell. Just like commands.
Not having the slightest clue about isql I guess it to be an sql interpreter. You can run it interactively to perform ad hoc queries etc., or have it read and interpret sql scripts. One among others is the way you show in post#1 using a "here document".
I'd propose to prepare a shell script very similar to the one in post#1, make it executable, test it interactively, and, when happy with it, run it using su's -c option.
EDIT: Looks like my post crossed your recent update of your post...
I am using ISQL command in ksh script.
Suppose if i get NULL value from the query which i run,how can i handle it?
I am getting a NULL result set and the following error is coming.
############### output of isql command for getting the sum of JEs ################
-----------
NULL... (4 Replies)
I am trying to run a query which returns a sum value(a number).
I want to get it in a variable so that i can refer to that variable in different places.
when i am running the following command
variable=`isql -Uuser -Sserver -Ppassword
1> select sum(count(*)) from xyz..abc where clm_id... (2 Replies)
HI ,
I'm facing the FTP connection refused from text editor while accessing AIX server .It showing the messege "can't create ftp connection connectin refused".Though it is accessible from putty .
i'm using aix version 6 .
Can any one let me know the seetings needs to be made so that i... (2 Replies)
Hi,
I am using RHEL4 and Oracle11g , my application requires odbc connection
hence I modified ODBC.ini file and when I exceute isql commande I got the following error.
isql: error while loading shared libraries: /opt/nastel/apwmq/odbc/lib/libodbc.so.1: requires glibc 2.5 or later dynamic... (4 Replies)
Hi,
I am using RHEL4 and Oracle11g , my application requires odbc connection
hence I modified ODBC.ini file and when I exceute isql commande I got the following error.
isql: error while loading shared libraries: /opt/nastel/apwmq/odbc/lib/libodbc.so.1: requires glibc 2.5 or later dynamic... (1 Reply)
I am using Linux RHEL5 64 bit and installed oracle 11g.
I want to check ODBC connection , i had modified odbc.ini file
when i use this command -isql
I am getting following error .
bash: isql: command not found
Kindly help (5 Replies)
Hi,
I need to connect to DB through my shell script. but I dont want to hardcode my db password in the script. Is there a way to do it?
Thanks
---------- Post updated at 07:42 PM ---------- Previous update was at 04:54 PM ----------
:(Guys..please help me with this:( (1 Reply)
Hi,
My systems manager wrote some reports using isql's 'ace' reporting program. He wants me to run these monthly from cron. Can this be done? can I run these reports from the command line(from a shell script)?
Thanks! (0 Replies)
:1,10 s/yes/no/g
this ex command will substitute yes with no everytime it is found within the first 10 lines of the file.
:s/yes/no/g
this ex command will substitute yes with no everytime it is found for the line where the cursor is on
my question is how could this substitution be... (4 Replies)