-
-
Save ryanmaclean/2a99b8db349c38179866 to your computer and use it in GitHub Desktop.
Run Alfresco Start Up Script as a User Other Than Root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# chkconfig: 2345 80 30 | |
# description: Alfresco Enterprise | |
# | |
# Username YOURUSER used in this case. Replace with one defined locally | |
# e.g.: with Chef or Puppet. | |
$YOURUSER = YOURUSER | |
RETVAL=0 | |
start () { | |
su -m $YOURUSER -c "cd /opt/alfresco && /opt/alfresco/alfresco.sh start" "$2" | |
RETVAL=$? | |
if [ -d "/var/lock/subsys" ] && [ `id -u` = 0 ] && [ $RETVAL -eq 0 ] ; then | |
touch /var/lock/subsys/alfresco | |
fi | |
} | |
stop () { | |
su -m $YOURUSER /opt/alfresco/alfresco.sh stop "$2" | |
RETVAL=$? | |
} | |
case "$1" in | |
start) | |
start "$@" | |
;; | |
stop) | |
stop "$@" | |
;; | |
restart) | |
stop "$@" | |
start "$@" | |
;; | |
*) | |
su -m $YOURUSER /opt/alfresco/alfresco.sh "$@" | |
RETVAL=$? | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment