| #!/bin/bash |
| # |
| # chkconfig: 35 90 12 |
| # description: keycloak server |
| # |
| |
| # Get function from functions library |
| . /etc/init.d/functions |
| |
| # Start the service Keycloak |
| start() { |
| initlog -c "echo -n Starting Keycloak server: " |
| nohup {{ user_home }}/{{ keycloak_install_dir }}/bin/standalone.sh -b 0.0.0.0 --server-config=standalone-ha.xml & |
| ### Create the lock file ### |
| touch /var/lock/subsys/keycloak |
| success $"keycloak server running" |
| echo |
| } |
| |
| # Restart the service FOO |
| stop() { |
| initlog -c "echo -n Stopping keycloak server: " |
| ps aux | grep keycloak | grep -v grep | awk '{print $2}' | xargs kill |
| ### Now, delete the lock file ### |
| rm -f /var/lock/subsys/keycloak |
| echo |
| } |
| |
| ### main logic ### |
| case "$1" in |
| start) |
| start |
| ;; |
| stop) |
| stop |
| ;; |
| status) |
| status keycloak |
| ;; |
| restart|reload|condrestart) |
| stop |
| start |
| ;; |
| *) |
| echo $"Usage: $0 {start|stop|restart|reload|status}" |
| exit 1 |
| esac |
| |
| exit 0 |