what command to stop database engine and restart run.sh?

Is there is a specific command I can use to safely stop the database engine, and then restart run.sh after it has been properly stopped? I wish to use an inotify tag to trigger this in a yaml file when the premkey is renewed. Can anyone please specify this for me? Here is an example of the yaml file I haven't gotten around to fine-tune:

version: '3'
services:
nginx:
image: nginx:1.15-alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./data/nginx:/etc/nginx/conf.d
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
command: "/bin/sh -c 'while :;
do sleep 6h & wait $${!}; \
nginx -s reload; done & nginx -g daemon off;'
"
certbot:
image: certbot/certbot
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
- ./conf/keystore
entrypoint: "/bin/sh -c 'trap exit TERM;
while :; do certbot renew; \
openssl pkcs12 -export -in /etc/letsencrypt/live/englishparrot.online/fullchain.pem
-inkey /etc/letsencrypt/live/englishparrot.online/privkey.pem
-out ./conf/keystore -name nrs -passout pass:koenyn676;
cp /etc/letsencrypt/live/englishparrot.online/privkey.pem ./conf/keystore/privkey.pem
sleep 12h & wait $${!}; done;'
"
myblockchain:
image: mychain
restart: always
build: .
volumes:
- /myvolume
ports:
- "7876:7876"
- "7874:7874"
- "443:443"
- "80:80"

I wish to put the inotifywait -m -e modify /conf/keystore/privkey.pem
alert after the privkey.pem has been copied, so that when inotifywait is triggered, it stops the blockchain database, and then restarts the blockchain's run.sh.
I'm not sure what syntax to use for this.

You cannot stop the db engine alone, you can shutdown the whole process. There is an API for that - "shutdown". Another option is to kill the process with the default TERM signal. Also there is a stop.sh script which does this

1 Like