forked from vab/sysadmin-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtomcat-post-upgrade.sh
More file actions
executable file
·40 lines (31 loc) · 1.48 KB
/
tomcat-post-upgrade.sh
File metadata and controls
executable file
·40 lines (31 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Tomcat Post Upgrade File Permission Adjustment Script
# Author: V. Alex Brennen <vab@mit.edu>
# License: This script is public domain.
# Date: 2013-12-17
# Description:
# This is a simple script to adjust Apache Tomcat file ownership
# on RHEL after an upgrade. This script is useful if you decide
# to run Apache Tomcat as a user other than "tomcat". Because, the
# RHEL Tomcat RPM post install script resets the file ownership
# on the log files and cache directories to tomcat even if they
# were changed by the local administrator.
# I use this script to help run the MIT DSpace digital repository
# system under the a "dspace" user. Running as a user other than
# "tomcat" makes it easier to load content both from the web
# interface and command line batch jobs while still isolating
# individual user accounts from the server configuration files
# and tomcat process.
UID="dspace"
GID="dspace"
/bin/chown $UID:$GID /var/log/tomcat6/catalina.out
/bin/chown -R $UID:$GID /var/cache/tomcat6
# The DSpace software currently recommends installation in a webapps
# directory in the home directory of the user running the system,
# typically "dspace". The RHEL RPM post install script will remove a
# symlink in the '/var/lib/tomcat6/webapps' location and replace it
# with an empty directory. These next command remove the new empty
# directory and recreate the symlink.
WEBAPPS_LOC="/home/dspace/webapps"
/bin/rm -r /var/lib/tomcat6/webapps
/bin/ln -s $WEBAPPS_LOC /var/lib/tomcat6/webapps