-
Notifications
You must be signed in to change notification settings - Fork 6
Optimize shutdown #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1f27265
Switch from sync shutdown to variant using SIGCONT as KillSignal. Int…
fc41ba5
Add possibility to overwrite systemd unit and sysvinit service templa…
8f0983e
Optimize sysvinit / upstart service file
4b0cd31
Add synchronous stop script wrapper, disable systemd killmode to ensu…
0894f22
Wait at least 1 second when restarting
1f8e4fb
Increase aem_cms_timeout_seconds to 1200 seconds (same as wcm_io_devo…
ec9ecfe
Use stop-sync.sh in systemd and upstart/systemv
e8f8e25
Readd TimeoutStopSec with additional 30 seconds to give the stop-sync…
0778cda
Reuse existing AEM_ROOT variable to build PID_PATH
7842f96
Update documentation
ee49f54
Merge branch 'master' into feature/optimize-shutdown
751c77e
Remove unrelated whitespace changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,63 @@ | ||
| #!/bin/sh -e | ||
| ### BEGIN INIT INFO | ||
| # Provides: {{ aem_cms_service_name }} | ||
| # Required-Start: $local_fs $remote_fs $network $syslog $named | ||
| # Required-Stop: $local_fs $remote_fs $network $syslog $named | ||
| # Default-Start: 2 3 4 5 | ||
| # Default-Stop: 0 1 6 | ||
| # Short-Description: Start AEM process | ||
| # Description: Init script for AEM instance {{ aem_cms_service_name }} | ||
| ### END INIT INFO | ||
|
|
||
| # Source function library. | ||
| #. /etc/rc.d/init.d/functions | ||
| . /lib/lsb/init-functions | ||
|
|
||
| SCRIPT_NAME=`basename $0` | ||
| AEM_ROOT={{ aem_cms_home }} | ||
| AEM_USER={{ aem_cms_user }} | ||
|
|
||
|
|
||
| ######## | ||
| BIN=${AEM_ROOT}/crx-quickstart/bin | ||
| START=${BIN}/start | ||
| STOP="${BIN}/stop --sync" | ||
| STATUS="${BIN}/status" | ||
|
|
||
| aem_start() { | ||
| if $0 status > /dev/null ; then | ||
| log_success_msg "$SCRIPT_NAME already started" | ||
| else | ||
| log_daemon_msg "Starting $DESC" "$SCRIPT_NAME" | ||
| su - ${AEM_USER} ${START} > /dev/null | ||
| log_end_msg 0 | ||
| fi | ||
| } | ||
|
|
||
| aem_stop() { | ||
| if $0 status > /dev/null ; then | ||
| log_daemon_msg "Stopping $DESC" "$SCRIPT_NAME" | ||
| su - ${AEM_USER} -c "bash ${STOP}" > /dev/null | ||
| log_end_msg 0 | ||
| else | ||
| log_success_msg "$SCRIPT_NAME not started" | ||
| fi | ||
| } | ||
|
|
||
| case "$1" in | ||
| start) | ||
| aem_start | ||
| ;; | ||
| stop) | ||
| aem_stop | ||
| ;; | ||
| status) | ||
| su - ${AEM_USER} ${STATUS} | ||
| ;; | ||
| restart) | ||
| aem_stop | ||
| aem_start | ||
| ;; | ||
| *) | ||
| echo "Usage: $SCRIPT_NAME {start|stop|status|restart}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| #!/bin/bash | ||
| ### BEGIN INIT INFO | ||
| # Provides: {{ aem_cms_service_name }} | ||
| # Required-Start: $local_fs $remote_fs $network $syslog $named | ||
| # Required-Stop: $local_fs $remote_fs $network $syslog $named | ||
| # Default-Start: 2 3 4 5 | ||
| # Default-Stop: 0 1 6 | ||
| # Short-Description: Start AEM process | ||
| # Description: Init script for AEM instance {{ aem_cms_service_name }} | ||
| ### END INIT INFO | ||
|
|
||
| # Source function library. | ||
| . /lib/lsb/init-functions | ||
|
|
||
| SCRIPT_NAME=`basename $0` | ||
| AEM_ROOT={{ aem_cms_home }} | ||
| AEM_USER={{ aem_cms_user }} | ||
| PID_PATH={{ aem_cms_home }}/crx-quickstart/conf/cq.pid | ||
| STOP_TIMEOUT_SECONDS={{ aem_cms_stop_timeout_seconds }} | ||
|
|
||
|
|
||
| ######## | ||
| BIN=${AEM_ROOT}/crx-quickstart/bin | ||
| START=${BIN}/start | ||
| STOP=${BIN}/stop-sync.sh | ||
| STATUS="${BIN}/status" | ||
|
|
||
| aem_start() { | ||
| pidResult=$(pgrep --pidfile $PID_PATH || true); | ||
| if [[ $pidResult != "" ]]; | ||
| then | ||
| log_success_msg "$SCRIPT_NAME already started" | ||
| else | ||
| log_daemon_msg "Starting $SCRIPT_NAME" | ||
| su - ${AEM_USER} ${START} > /dev/null | ||
| log_end_msg 0 | ||
| fi | ||
| } | ||
|
|
||
| aem_stop() { | ||
| # execute sync stop script | ||
| su - ${AEM_USER} -c "bash ${STOP}" | ||
| } | ||
|
|
||
| case "$1" in | ||
| start) | ||
| aem_start | ||
| ;; | ||
| stop) | ||
| aem_stop | ||
| ;; | ||
| status) | ||
| su - ${AEM_USER} ${STATUS} | ||
| ;; | ||
| restart) | ||
| aem_stop | ||
| aem_start | ||
| ;; | ||
| *) | ||
| echo "Usage: $SCRIPT_NAME {start|stop|status|restart}" | ||
| exit 1 | ||
| ;; | ||
| esac |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/bash | ||
| # Source function library. | ||
| . /lib/lsb/init-functions | ||
|
|
||
| SCRIPT_NAME=`basename $0` | ||
| AEM_ROOT={{ aem_cms_home }} | ||
| AEM_SERVICE_NAME={{ aem_cms_service_name }} | ||
| PID_PATH=${AEM_ROOT}/crx-quickstart/conf/cq.pid | ||
| STOP_TIMEOUT_SECONDS={{ aem_cms_stop_timeout_seconds }} | ||
|
|
||
| ######## | ||
| BIN=${AEM_ROOT}/crx-quickstart/bin | ||
| STOP=${BIN}/stop | ||
|
|
||
| # check if instance is running | ||
| pidResult=$(pgrep --pidfile $PID_PATH || true); | ||
| if [[ $pidResult != "" ]]; | ||
| then | ||
| # AEM is running | ||
| log_daemon_msg "Stopping $AEM_SERVICE_NAME" | ||
| bash ${STOP} > /dev/null | ||
| while [ "$STOP_TIMEOUT_SECONDS" != "0" ]; do | ||
| sleep 1s | ||
| pidResult=$(pgrep --pidfile $PID_PATH || true); | ||
| if [[ $pidResult == "" ]]; | ||
| then | ||
| break; | ||
| fi | ||
|
|
||
| log_progress_msg "." | ||
| let STOP_TIMEOUT_SECONDS-=1; | ||
|
|
||
| done | ||
| # check if AEM process has to be terminated | ||
| pidResult=$(pgrep --pidfile $PID_PATH || true); | ||
| if [[ $pidResult != "" ]]; | ||
| then | ||
| log_daemon_msg "Killed $AEM_SERVICE_NAME because shutdown timeout was reached" | ||
| kill -9 $(cat $PID_PATH); | ||
| fi | ||
| log_end_msg 0 | ||
| else | ||
| # AEM is not running | ||
| log_success_msg "$AEM_SERVICE_NAME already stopped" | ||
| log_end_msg 7 | ||
tobias-richter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.