I have some bash scripts vistastop.sh vistastart.sh that I created long ago in the Astronaut VistA variant distribution. You direct systemd or whichever flavor of linux you have to run these scripts on start or shutdown.
-- Ignacio Valdes, MD, MS, ABPM, ABPN, CAM
more vistastart.sh
#!/bin/bash
# vistastart
#!/bin/bash
cd `dirname $0`
if [ $EUID -eq 0 ]; then
echo "Run as $vista_user, not as root."
exit;
fi
rm -f ../tmp/*.mj[oe]
source /opt/astrovista/EHR/etc/env.astrovista
echo "vistastart gtm_dist: $gtm_dist, gtm_vista: $gtm_vista"
$gtm_dist/mupip journal -recover -backward $gtm_vista/journals/mumps.mjl
$gtm_dist/mupip rundown -region DEFAULT
rm -f $vista_path/globals/scratch.dat
rm -f $vista_path/globals/mumps.gld
echo "before GDE"
# Merged similar Astronaut install script stuff and the below about 20 lines wit
h Medsphere Systems Corp.
# instanceadd script with Astronaut variable modifications and a few changes.
# Per Gus, allocation count resulting in 2Gb and extension count 0 is better bec
ause you will fill
# up your database before you fill up your disk.
(
umask 027
#$gtm_path/mumps -run ^GDE <<EOF
$gtm_path/mumps -run ^GDE > /dev/null 2>&1 <<EOF
CHANGE -SEGMENT DEFAULT -ACCESS_METHOD=BG -BLOCK_SIZE=4096 -ALLOCATION=500000 -E
XTENSION_COUNT=0 -GLOBAL_BUFFER_COUNT=4096 -LOCK_SPACE=400 -FILE=$vista_path/glo
bals/mumps.dat
CHANGE -REGION DEFAULT -RECORD_SIZE=4080 -KEY_SIZE=255 -JOURNAL=(BEFORE_IMAGE,FI
LE_NAME="$vista_path/journals/mumps.mjl") -DYNAMIC_SEGMENT=DEFAULT
TEMPLATE -SEGMENT -ACCESS_METHOD=BG -BLOCK_SIZE=4096 -ALLOCATION=1024 -EXTENSION
_COUNT=1024 -GLOBAL_BUFFER_COUNT=4096 -LOCK_SPACE=400
TEMPLATE -REGION -RECORD_SIZE=4080 -KEY_SIZE=255 -NOJOURNAL
ADD -SEGMENT SCRATCH -FILE=$vista_path/globals/scratch.dat
ADD -REGION SCRATCH -DYNAMIC_SEGMENT=SCRATCH
ADD -NAME TMP -REGION=SCRATCH
ADD -NAME TEMP -REGION=SCRATCH
ADD -NAME UTILITY -REGION=SCRATCH
TEMPLATE -REGION -RECORD_SIZE=4080 -KEY_SIZE=255 -JOURNAL=BEFORE_IMAGE
EXIT
EOF
)
# mumps doesn't exit non-zero even if something goes wrong in ^GDE, so look for
# the mumps.gld to determine success
[ -f "$vista_path/globals/mumps.gld" ] ||
exit_with_error "$vista_path/instanceadd.sh" "Unable to create global directory
file"
mv $vista_path/globals/mumps.dat $vista_path/globals/mumps.tmp
$gtm_path/mupip create
rm -f $vista_path/globals/mumps.dat
mv $vista_path/globals/mumps.tmp $vista_path/globals/mumps.dat
[ -f "$vista_path/globals/scratch.dat" ] ||
exit_with_error "$vista_path/instanceadd.sh" "Unable to create scratch.dat file"
chmod 760 $vista_path/globals/scratch.dat
#echo "before .1 zosf."
$gtm_dist/mumps -direct > /dev/null 2>&1 << EOF
SET ^%ZOSF("TMP")="$vista_path/bin/tmp"
h
EOF
$gtm_dist/mupip set -journal=enable,on,before,filename=$vista_path/journals/mump
s.mjl -region DEFAULT
#$gtm_dist/mupip set -journal="enable,on,before" -file $gtm_vista/globals/mumps.
dat
echo "before box:volume"
# Set box:volume pair.
#$gtm_path/mumps -r ^VWSTART <<EOF
$gtm_path/mumps -r ^VWSTART > /dev/null 2>&1 <<EOF
XUTIME
EOF
#$gtm_path/mumps -direct > /dev/null 2>&1 <<EOF
$gtm_path/mumps -direct <<EOF
S DUZ=1
D RESTART^ZTMB
y
EOF
# Engage in note imaging.
#$gtm_path/mumps -direct <<EOF
#S DUZ=1
#D ASTROIMG^TMGRPC1D
#
#h
#EOF
# Give the path for the console.
#$gtm_path/mumps -direct <<EOF
#S DUZ=1 D ^XUP,SETUP^TMGKERN3
#$vista_path/bin/run.sh
#
#h
#EOF
find $gtm_vista/globals -iname mumps.mjl_\* -mtime +3 -exec rm -v {} \;
echo "`date` $tmp_date Server start." >> $vista_path/log/vista_server.log
more vistastop.sh does a clean shutdown of VistA
#!/bin/bash
#vistastop
#!/bin/bash
cd `dirname $0`
echo "pwd: `pwd`"
source /opt/astrovista/EHR/etc/env.astrovista
cd $vista_path/bin
./run.sh STOP^ZTMKU <<EOF
y
y
h
EOF
sleep 1
ps -ef | grep mumps | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null
echo "`date` $tmp_date Server stop." >> $vista_path/log/vista_server.log