I am creating a script to monitor a certain applications running in my Unix system.
My script order goes this way:
df -h /of/a/filesystem
tail -5 /path/to/an/application/availability
su -c "jsmon pf=(profile of my application) `echo "p"`" usradm
#EOF
I am encountering problem on my 3rd line. Basically what I wanted is when
my script run, it switches to user "usradm" execute command " jsmon pf=(profile of my application " and then echo the letter "p".
My script runs the switch to usradm command and executes program " jsmon pf=(profile of my application) " however won't execute "p" command after and getting error like:
JStart Monitor Program
jsmon=>appparam(2): fopenU("/home/usradm","r"): No such file or directory
jsmon=>No Profile used.
jsmon=>appparam: SYSTEMNAME neither in Profile nor in Commandline
Thu Oct 20 06:45:30 2016 (initial: p)
JsfOpenShm failed: object not found
Cannot access shared memory.
Thu Oct 20 06:45:30 2016>
If you want to execute the echo command after jsmon finished you have to separate the 2 commands. Otherwise jsmon is called with an additional parameter with the value p.
su - -c "jsmon pf=(profile of my application); echo p" usradm
I tried your suggestion but I'm still getting the same error as before.
To answer your question about `echo "p"` once the user enters the program and input "p" (short for print) it lists all the server status of the application.
---------- Post updated at 05:07 PM ---------- Previous update was at 04:55 PM ----------
Hello cero,
Thanks for your response.
When I tried to seperate the two commands, it executes echo p command after exiting the program.
Sequence goes like this:
su - -c "jsmon pf=(profile of my application); echo p" usradm
switches to usradm
launches the program jsmon
doesn't print "p"
when exiting the program, it then prints "p"
exampe:
Fri Oct 21 07:01:54 2016> quit
p
once a program is launched, is it impossible to execute a command inside the program environment?
Thank you.
It worked, but now it continuously print "p". Tried adding " | echo quit " after jsmon pf=(profile of my application) but it returned quit command
example:
quit
[1] 22894 22895
Is it possible to stop inputting "p"? one time is more than enough.