Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 5244  / 2 Years ago, mon, june 13, 2022, 9:18:25

I have an upstart script to start a custom nodejs app. The app depends on couchdb and elasticsearch. couchdb and elasticsearch provide init.d scripts for starting/stopping them. Is it possible to tell my upstart script that couchdb and elasticsearch are dependencies? I tried this in my upstart script but it does not seem to work:



start on (started couchdb and started elasticsearch)



Thanks!


More From » upstart

 Answers
0

The only thing I know that would work is to create (or search for and install) upstart scripts for both elasticsearch and couchdb so you can use the "start on" option.




Upstart script for couchdb




# couchdb v1.2.0
#
# Custom installation of CouchDB

description "CouchDB v1.2.0, local"
console output

# start after all filesystems & network interfae are available
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]

# set working directory
env COUCHDB_WD="/path/to/build-couchdb/build/bin"
export COUCHDB_WD

# required for erlang
env HOME="/home/user"
export HOME

script
# modify PATH to hit local couchdb's working directory first
PATH="$COUCHDB_WD:$PATH"
#export PATH # not necessary inside script block
#logger -t $0 "HOME='$HOME'"
#logger -t $0 "PATH='$PATH'"
# output couchdb logs to custom location
#exec >>/home/user/couchdb_local.log 2>&1
exec couchdb
end script





Upstart for elasticsearch




# ElasticSearch Service

description "ElasticSearch"

start on (net-device-up
and local-filesystems
and runlevel [2345])

stop on runlevel [016]

respawn limit 10 5

env ES_HOME=/usr/share/elasticsearch/home
env ES_MIN_MEM=256m
env ES_MAX_MEM=2g
env DAEMON="${ES_HOME}/bin/elasticsearch"
env DATA_DIR=/data/elasticsearch/data
env CONFIG_DIR=/etc/elasticsearch

console output

script
if [ -f /etc/default/elasticsearch ]; then
. /etc/default/elasticsearch
fi

su -s /bin/dash -c "/usr/bin/elasticsearch -f -Des.path.conf=$CONFIG_DIR -Des.path.home=$ES_HOME -Des.path.logs=$LOG_DIR -Des.path.data=$DATA_DIR -Des.path.work=$WORK_DIR" elasticsearch
end script



[#31779] Wednesday, June 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
azaaburge

Total Points: 266
Total Questions: 85
Total Answers: 109

Location: Djibouti
Member since Sat, Oct 29, 2022
2 Years ago
;