I have a script in which I am doing a queryformat and if a java rpm has been installed within 10 minutes, I would like the server to reboot. If a java rpm has not been installed then do not reboot. I can get it for glibc but for java I am having an issue... any help would be appreciated.
Hopefully I got the code tags right...
I have a script in which I am doing a queryformat and if a java rpm has been installed within 10 minutes, I would like the server to reboot. If a java rpm has not been installed then do not reboot. I can get it for glibc but for java I am having an issue... any help would be appreciated.
Hopefully I got the code tags right...
Thanks
gartie
You got the CODE tags right. Thank you.
But the code has several syntax and logic errors:
running lines together where a <newline> is required,
missing closing parentheses,
piping the output of a variable assignment (which produces no output) into a grep command,
and using the values of variables that have not been assigned values ($date and $rpm).
I don't use rpm, and none of this has been tested, but it should get rid of most of the bash syntax problems and might come close to what you're trying to do:
It didn't install but still rebooted the server...
I cant get past that piece of logic where it looks at the time and if it greater than 10 minutes it does not reboot, if less then it does reboot.
thanks...
Show us the output from the command:
I'm guessing that the output produced is not a number, so the subtraction from the current time isn't going to work correctly.
We need to know what the output will be in a case where java is installed and in the case where java has not been installed. (I would assume that there just won't be a line with java in the output if it is not installed. Is this a correct assumption? If so, and if java has not been installed, you'll get a syntax error in the arithmetic substitution.)
Update: If multiple versions of java have been installed, could you end up with multiple lines coming out of the grep?
Last edited by Don Cragun; 11-12-2015 at 02:54 PM..
Reason: Add another question.
It didn't install but still rebooted the server...
I cant get past that piece of logic where it looks at the time and if it greater than 10 minutes it does not reboot, if less then it does reboot.
thanks...
Unfortunately you are under the impression that rpm -qa --queryformat "%{name}-%{INSTALLTIME:date}\n"} |grep java will produce a number in seconds that can be subtracted from the current now time in second, but it is not so.
I do not have java installed but I will demonstrate with a package I have installed:
This string needs to be converted into seconds before it can be used to subtract from now.
Perhaps something like:
Notice that I am querying the wanted package directly (in your case Java), since I know what I want, instead of querying all installed packages and then filtering via grep.
Then you can subtract, assuming that $install_time got a good input:
In my opinion there's no advantage of creating a calculation with MAX_Time=$(bc <<< '10*60') or the correct alternative MAX_Time=$((10*60)) when I know that 10 minutes is 600 seconds.
I can even add a comment along side to advertise its meaning and remove the magic out of it.
dears
i am trying to install the autoconf-2.63-1.aix6.1.noarch.rpm but its shows the below error message .
P700_dev/svn/dependencies>rpm -i autoconf-2.63-1.aix6.1.noarch.rpm
error: failed dependencies:
m4 is needed by autoconf-2.63-1
P700_dev/svn/dependencies> (6 Replies)
Hello,
I have kubuntu on my laptop and now I decided to switch to Windows 7. I made the bios settings properly (first choice is boot from cd\vd) but I see the error
" reboot and select proper Boot device or insert Boot media in select Boot device and press a key "
I have tried CD and... (0 Replies)
How to make RPM not write to RPM database if RPM fails to deploy?
IE I create an rpm spec file that contains the following
if
then
exit 1
fi
My rpm will fail at deployment, but if I do rpm -qa , I can see the rpm in the rpm db (3 Replies)
It's the end of the day and I just can't get my head around this. I'm trying to extract just the name of the RPM from the path to a .rpm file. So from:
/home/me/rpm/RPMS/i386/nagios-our-plugins-1.2-6.i386.rpmI need to extract 'nagios-our-plugins'.
I can't get the awk syntax right:
awk '{... (5 Replies)
Hi,
I have got few RPM's from rpmfind.net ( mainly gcc ).
But it seems to be src files instead of the image.
so I think we have to build the src files according to target machine using rpmbuild.
Can any one help me with
1) Various options of rpm build that have to be taken care
2)... (3 Replies)
Hi,
I need to install an rpm file,but I only have '.src.rpm' version of it. I want to convert it to a binary rpm.
so I tried this
rpm --rebuild somethin.src.rpm
But I am gettin '--rebuild:Invalid option' as output
Is there another way to rebuild source rpm.?
Thanks in... (2 Replies)
When I installed the SOLARIS 10 OS first time, the desktop would not start up, this was because of network setup. Reinstalled worked. After a week due to some problem I had to reinstall OS, installation went fine and but when i reboot I get this error.
cannot find mis/krtld
boot error loading... (0 Replies)
Hey !
I am running EWS-UX/V (Rel 4.2) on NEC EWS/4800/330 station and I am having problems rebooting my station : I am getting the following message on display : BOOT : PANIC : File size out of range.
According to user guide, this error is occuring when a file exceeding the limit and/or... (2 Replies)
Hey,
I've a problem installing a package. rpm -ivh brings the errors:
libjvm.so is needed by
libverify.so is needed by
But I have installed the Java SDK like requested and the files are on the disk. But I have no idea how to find out, why rpm cann't find them.
I have also... (2 Replies)
I have an application for linux writen by me. and before use it, I have to install it. I 've writen a shell program to install it. Now how can I turn it to the *.rpm ? Is this can done by shell command rpm? How to do it?
thanks (1 Reply)