Created
August 31, 2012 08:55
-
-
Save billerby/3550468 to your computer and use it in GitHub Desktop.
alfresco startup deamon script set to run by another user 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 | |
# | |
RETVAL=0 | |
start () { | |
su -m ec2-user -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 ec2-user /opt/alfresco/alfresco.sh stop "$2" | |
RETVAL=$? | |
} | |
case "$1" in | |
start) | |
start "$@" | |
;; | |
stop) | |
stop "$@" | |
;; | |
restart) | |
stop "$@" | |
start "$@" | |
;; | |
*) | |
su -m ec2-user /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