Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to change the path location within the shell script? Post 303043672 by sravani25 on Monday 3rd of February 2020 02:08:14 PM
Old 02-03-2020
How to change the path location within the shell script?

Hi ALL,


I am trying to find the installed tomcat version and location of the server.xml file to get the tomcat port number.


Using below script to do that.


Code:
#!/usr/bin/env bash

var1=$(find / -name "version.sh" ! -size 0 2>&1 |egrep -v "tmp|docker")

for loc1 in $var1
do
    abc=$(echo "$loc1" | rev | cut -c 11- | rev)
    tomcat_version=$(cd "$abc";./version.sh | grep "Server number:" | awk '{print $3}')
    tomcat_status=`tomcat`

    if [ "$tomcat_version" != "" ];then
    echo $tomcat_version
     echo "$abc"
     

    break
    fi
done


but in order to get the port number i want to change from tomcat/bin to tomcat/conf location.
For that i tried to use below synatx but it's not working.
Code:
echo "$(cd "$abc";../..)"

Can someone please suggest how to change the path?

Last edited by rbatte1; 02-07-2020 at 07:46 AM..
 

10 More Discussions You Might Find Interesting

1. OS X (Apple)

shell script location w/ Panther

I'm sure there things have only been asked a thousand times (I just couldn't find the answers): I am running Panther (Mac OS X ver. 10.3.2.). I am using the (default) bash shell. I am *starting* to write shell scripts. I would like to "install" some shell scripts, so that they are always... (2 Replies)
Discussion started by: ropers
2 Replies

2. Shell Programming and Scripting

Find the geographical location within a shell script

Hi, I need a shell script that when run should be able to find the geographical location of the system. can anyone help me with this? Thanks, Sundeep (1 Reply)
Discussion started by: eamani_sun
1 Replies

3. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

4. Shell Programming and Scripting

How to change Absolute path to Relative path

Hello, I have a doubt:- --------------------- Current script:- ################################################################################################ prefix=user@my-server: find . -depth -type d -name .git -printf '%h\0' | while read -d "" path ; do ( cd "$path" || exit $?... (4 Replies)
Discussion started by: sahil_jammu
4 Replies

5. UNIX for Dummies Questions & Answers

jre location PATH

How do you set the classpath for jre location....What are all the steps? (4 Replies)
Discussion started by: siddhans
4 Replies

6. Shell Programming and Scripting

shell script to add input at certain location into a file

Hi, I am using Solaris 10 OS and trying to create shell script that can add input at certain location into a file. The input that I am trying to put is new domain name e.g @newdomain.com the file contains, more test01.out user/zzzz786@st.com/INBOX user/zzzz@po.com/INBOX... (8 Replies)
Discussion started by: Mr_47
8 Replies

7. Shell Programming and Scripting

Change Shell Command Path

I want to change the path for the command in a shell. I want to make it easier to type in the command when I run the shell. As of now, I have to type in /bin/ls but I want to just type in "ls" instead. I have altered the function below to do this but it's not working. It still must have the full... (1 Reply)
Discussion started by: JustinT2474
1 Replies

8. Shell Programming and Scripting

Copying the files in to multiple location using shell script

Hi All, i'm trying to copy the 1.txt files (sample files) in to different path location using the below command. But it is not copying the files , when i tried for single location able to copy the file. can any one please assist here. Please find the below path :- /ckr_mkr1/licencekey... (2 Replies)
Discussion started by: venkat918
2 Replies

9. Shell Programming and Scripting

File transfer from UNIX to shared location using shell script

Is there any possible way transfering the file from unix to shared location using shell script. i had created the batch script to fetch the files from unix to shared location and it works fine. Due to some problem in windows unable to transfer the file to shared location automatically. can anyone... (2 Replies)
Discussion started by: venkat918
2 Replies

10. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies
pki-server-upgrade(8)					      PKI Server Upgrade Tool					     pki-server-upgrade(8)

NAME
pki-server-upgrade - Tool for upgrading Certificate System server configuration. SYNOPSIS
pki-server-upgrade [OPTIONS] DESCRIPTION
There are two parts to upgrading Certificate System: upgrading the system configuration files used by both the client and the server pro- cesses and upgrading the server configuration files. When upgrading Certificate System, the existing server configuration files (e.g. server.xml, web.xml) may need to be upgraded because the content may have changed from one version to another. The configuration upgrade is executed automatically during RPM upgrade. However, in case there is a problem, the process can also be run manually using pki-server-upgrade. The server upgrade process is done incrementally using upgrade scriptlets. A server consists of the server instance itself and the subsys- tems running in that instance. The upgrade process executes one scriptlet at a time, running through each component (server instance and subsystem) in parallel and completing before executing the next scriptlet. If one component encounters an error, that component is skipped in the subsequent upgrade scriptlets. The upgrade process and scriptlet execution for each component is monitored in upgrade trackers. A counter shows the latest index number for the most recently executed scriptlet; when all scriptlets have run, the component tracker shows the updated version number. The scriptlets are stored in the upgrade directory: /usr/share/pki/server/upgrade/<version>/<index>-<name> The version is the server version to be upgraded. The index is the script execution order. The name is the scriptlet name. During upgrade, the scriptlets will back up all changes to the file system into the following folder: /var/log/pki/server/upgrade/<version>/<index> The version and index values indicate the scriptlet being executed. A copy of the files and folders that are being modified or removed will be stored in oldfiles. The names of the newly-added files and folders will be stored in newfiles. The instance upgrade process is tracked using this file: /var/lib/pki/<instance>/conf/tomcat.conf The subsystem upgrade process is tracked using this file: /var/lib/pki/<instance>/<subsystem>/conf/CS.cfg The file stores the current configuration version and the last successful scriptlet index. OPTIONS
General options --silent Upgrade in silent mode. --status Show upgrade status only without performing the upgrade. --revert Revert the last version. -i, --instance <instance> Upgrade a specific instance only. -s, --subsystem <subsystem> Upgrade a specific subsystem in an instance only. -t, --instance-type <type> Upgrade a specific instance type, by the major version number of the Dogtag instance. For example, use 9 for Dogtag 9 instances and 10 for Dogtag 10. -X Show advanced options. -v, --verbose Run in verbose mode. -h, --help Show this help message. Advanced options The advanced options circumvent the normal component tracking process by changing the scriptlet order or changing the tracker information. WARNING: These options may render the system unusable. --scriptlet-version <version> Run scriptlets for a specific version only. --scriptlet-index <index> Run a specific scriptlet only. --remove-tracker Remove the tracker. --reset-tracker Reset the tracker to match the package version. --set-tracker <version> Set the tracker to a specific version. OPERATIONS
Interactive mode By default, pki-server-upgrade will run interactively to upgrade all server instances and subsystems on the machine. It will ask for a con- firmation before executing each scriptlet. % pki-server-upgrade If there is an error, it will stop and show the error. Silent mode The upgrade process can also be done silently without user interaction: % pki-server-upgrade --silent If there is an error, the upgrade process will stop for that particular instance/subsystem. Other instances/subsystems will continue to be upgraded. Checking upgrade status It is possible to check the status of a running upgrade process. % pki-server-upgrade --status Troubleshooting Check the scriptlet to see which operations are being executed. Once the error is identified and corrected, the upgrade can be resumed by re-running pki-server-upgrade. If necessary, the upgrade can be run in verbose mode: % pki-server-upgrade --verbose It is possible to rerun a failed script by itself, specifying the instance and subsystem, version, and scriptlet index: % pki-server-upgrade --instance pki-tomcat --subsystem ca --scriptlet-version 10.0.1 --scriptlet-index 1 Reverting an upgrade If necessary, the upgrade can be reverted: % pki-server-upgrade --revert Files and folders that were created by the scriptlet will be removed. Files and folders that were modified or removed by the scriptlet will be restored. FILES
/usr/sbin/pki-server-upgrade AUTHORS
Ade Lee <alee@redhat.com>, Ella Deon Lackey <dlackey@redhat.com>, and Endi Dewata <edewata@redhat.com>. pki-server-upgrade was written by the Dogtag project. COPYRIGHT
Copyright (c) 2013 Red Hat, Inc. This is licensed under the GNU General Public License, version 2 (GPLv2). A copy of this license is avail- able at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. version 1.0 Jul 22, 2013 pki-server-upgrade(8)
All times are GMT -4. The time now is 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy