Sponsored Content
Top Forums Shell Programming and Scripting Setting java and returning version Post 302828397 by bigbenn on Tuesday 2nd of July 2013 11:20:49 AM
Old 07-02-2013
Setting java and returning version

I am currently trying to write a script and I am not that great at wording it with taking in user input, it will do the following:

ask " Have you stopped instances? "
if instances are stopped, then I want it to change to the default java to 64 bits, and print the current version of java.
Afterwards I want it to return the default back to 32 bits.

Basically I want it to remove the existing symlink and recreate a new link to point to the other java version and display the info.
Code:
 
#!/bin/ksh
# -*- Mode: Bash; tab-width: 2; indent-tabs-mode: nil -*- vim:sta:et:sw=2:ts=2:syntax=sh
 
read -p " Have you stop the instances? [yn]" answer
if [ $answer = y ] 
then 
read -p " Do you want to set Java default to 64 bits? [yn]" answer
  if [ $answer = y ]
then (setServerJava -b 64)
elif
read -p " Do you want to set Java default to 32 bits? [yn]" answer
  if [ $answer = y ]
then (setServerJava -b 32) 
else 
echo "You have not stopped instances yet, cannot set Java default."
fi
 
 if [ setServerjava -b 64 ]
then
JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
# export JAVA_VERSION
echo $JAVA_VERSION
 fi
fi

any and all help is GREATLY appreciated, thanx

Last edited by bigbenn; 07-02-2013 at 12:47 PM..
 

8 More Discussions You Might Find Interesting

1. Solaris

Setting link to newly installed Java version

Hi, I have Solaris 8 wih Java 1.2.2 as default. I just upgraded it to Java 2 version 1.4. But when I do "java -version: I get following: "Java version "1.2.2" Solaris VM (build Solaris_JDK_1.2.2_05a, native threads, sunjwit) How would I make solaris to look at my new java? If I have to... (4 Replies)
Discussion started by: harjitsingh
4 Replies

2. UNIX for Dummies Questions & Answers

malloc returning NULL if freemem high & swapmem low (MPRAS version 3.03 )

Hi All,:) In my application malloc is returning NULL even though there is sufficient amount of free memory available but the swap memory is low. Is this possible that, if free memory is high & swap memory is low, malloc will not be able to allocate memory & return NULL ? Few details: ... (4 Replies)
Discussion started by: Ritesh Kumar
4 Replies

3. Solaris

Solaris 10 Java version

I have an issue here setting up ASR with a server. In order to have the SASM service runnning/enabled, the required java version is 1.6 U18(latest). My OS came with JDK 1.5 I downloaded and installed 1.6 But when I did java -version , its still showing 1.5 I captured the below from another... (4 Replies)
Discussion started by: incredible
4 Replies

4. UNIX for Advanced & Expert Users

Advanced Search * View * Edit JAVA version to WORK in GLASSFISH Forum topic JAVA version

Would like to confirm the ff. I got confused actually with the version I needed to download that will work on glassfish 3.0.1 a. Debian Squeeze (HP DL360). Need to use java version6 On Debian, I did apt-get install sun-java6-jdk. So when I check it's java version "1.6.0_22" Java(TM) SE... (1 Reply)
Discussion started by: lhareigh890
1 Replies

5. Solaris

java (java -version)

hi my box is a global zone with no local zones and the command java -version shows as "1.5.0_26". now we got a requirement from the application team to install jdk1.5.0_24. Is it possible to install the version of java(jdk1.5.0_24) as requested by the application team or is it possible to... (2 Replies)
Discussion started by: newtoaixos
2 Replies

6. Shell Programming and Scripting

installed java version ?

Hi, I want to know what version of the java is installed? Please let me know the command or process to identify the installed java version in sun solaris box. Thanks in advance for all your support. (3 Replies)
Discussion started by: sridhardwh
3 Replies

7. Programming

Java Runtime.getRuntime().exec not returning any value

Hi, i written class like this but it is not returning any results and infact p.waitFor() is returning value 1. This is very basic program that i am planning to run in unix. This is really killing my time and unable to find correct reason.... (6 Replies)
Discussion started by: sbjv
6 Replies

8. HP-UX

Setting up new version of java

Hi, I have got jre 1.5 that I have got to install in the HP.UX version 11.31. I managed to install it with this command : # swinstall -s /tmp/<jre.XXXXX.depot> It automatically gets created in /opt/java1.5/jre/bin. However, now I am not sure how to set the PATH to JAVA_HOME, and path to... (1 Reply)
Discussion started by: anaigini45
1 Replies
DH_SYSTEMD_START(1)						     Debhelper						       DH_SYSTEMD_START(1)

NAME
dh_systemd_start - start/stop/restart systemd unit files SYNOPSIS
dh_systemd_start [debhelperoptions] [--restart-after-upgrade] [--no-stop-on-upgrade] [unitfile...] DESCRIPTION
dh_systemd_start is a debhelper program that is responsible for starting/stopping or restarting systemd unit files in case no corresponding sysv init script is available. As with dh_installinit, the unit file is stopped before upgrades and started afterwards (unless --restart-after-upgrade is specified, in which case it will only be restarted after the upgrade). This logic is not used when there is a corresponding SysV init script because invoke-rc.d performs the stop/start/restart in that case. OPTIONS
--restart-after-upgrade Do not stop the unit file until after the package upgrade has been completed. This is the default behaviour in compat 10. In earlier compat levels the default was to stop the unit file in the prerm, and start it again in the postinst. This can be useful for daemons that should not have a possibly long downtime during upgrade. But you should make sure that the daemon will not get confused by the package being upgraded while it's running before using this option. --no-restart-after-upgrade Undo a previous --restart-after-upgrade (or the default of compat 10). If no other options are given, this will cause the service to be stopped in the prerm script and started again in the postinst script. -r, --no-stop-on-upgrade, --no-restart-on-upgrade Do not stop service on upgrade. --no-start Do not start the unit file after upgrades and after initial installation (the latter is only relevant for services without a corresponding init script). NOTES
Note that this command is not idempotent. dh_prep(1) should be called between invocations of this command (with the same arguments). Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. Note that dh_systemd_start should be run after dh_installinit so that it can detect corresponding SysV init scripts. The default sequence in dh does the right thing, this note is only relevant when you are calling dh_systemd_start manually. SEE ALSO
debhelper(7) AUTHORS
pkg-systemd-maintainers@lists.alioth.debian.org 11.1.6ubuntu2 2018-05-10 DH_SYSTEMD_START(1)
All times are GMT -4. The time now is 05:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy