Skip to content

Commit

Permalink
Fix CouchDB manage restart option (#1496)
Browse files Browse the repository at this point in the history
* Fix CouchDB manage restart option

* Add agent operations aliases to the bashrc template
  • Loading branch information
amaltaro authored May 31, 2024
1 parent 169a727 commit 4641182
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docker/pypi/wmagent-couchdb/manage
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ sysboot()
# Start the service.
start()
{
echo "Starting CouchDB service..."
_parse_localini $COUCH_CONFIG_DIR/local.ini || { echo "$FUNCNAME: ERROR: Not configured database. Try manage init first"; return 1 ;}
cd $STATEDIR
echo -n "Which couchdb: "
which couchdb
echo " With configuration directory: $CFGDIR"
echo " With logdir: $LOGDIR"
echo " which couchdb: $(which couchdb)"
echo " configuration directory: $CFGDIR"
echo " log directory: $LOGDIR"
echo " nohup couchdb -couch_ini $CFGDIR >> ${LOGDIR}/couch.log 2>&1 &"
nohup couchdb -couch_ini $CFGDIR >> ${LOGDIR}/couch.log 2>&1 &

Expand All @@ -283,7 +283,7 @@ start()
stop()
{
echo "Stopping CouchDB service..."
for couch_pid in $(ps aux | egrep 'couchdb|couchjs' | awk '{print $2}'); do
for couch_pid in $(ps aux | grep -E 'couchdb|couchjs' | grep -Ev 'grep|/manage' | awk '{print $2}'); do
echo " killing CouchDB process... ${couch_pid}"
kill -s SIGTERM $couch_pid || true
done
Expand Down
12 changes: 12 additions & 0 deletions docker/pypi/wmagent/etc/wmagent_bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ alias condorqrunning='condor_q -constraint JobStatus==2 -format "%i." ClusterID
alias runningagent="ps aux | egrep 'couch|wmcore|mysql|beam'"
alias foldersize="du -h --max-depth=1 | sort -hr"

# agent operations
alias wma_unregister='manage execute-agent wmagent-unregister-wmstats $(hostname -f)'
alias wma_stop_component='manage execute-agent wmcoreD --shutdown --component ' # comma separated component names
alias wma_start_component='manage execute-agent wmcoreD --start --component ' # comma separated component names
alias wma_restart_component='manage execute-agent wmcoreD --restart --component ' # comma separated component names

# agent drain check
alias wma_drain='python /usr/local/bin/adhoc-scripts/drainAgent.py'

# agent tail of all component logs
alias wma_tail_logs='for comp in $(ls $WMA_INSTALL_DIR | grep -v Docker); do echo $comp; tail -n100 $WMA_INSTALL_DIR/$comp/ComponentLog; echo ""; done | less'

# Better curl command
alias scurl='curl -k --cert ${WMA_CERTS_DIR}/servicecert.pem --key ${WMA_CERTS_DIR}/servicekey.pem'

Expand Down

0 comments on commit 4641182

Please sign in to comment.