[Simh] SIMH as a Service (revisited)

Mark Benson md.benson at gmail.com
Sat Jun 16 10:25:17 EDT 2012


Holy thread necromancy! I only just started work on this, I'm sorry it's taken 9 months! :)

Here is what my /etc/init.d/simh file looks like.

#!/bin/sh
# Start/stop the VAX virtual guest
#
### BEGIN INIT INFO
# Provides:          simh
# Required-Start:    networking
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      1
# Short-Description: Virtual VAX (SIMH)
# Description:       VAX is a virtual computer system running under a VAX
#                    emulator that is part of SIMH. This VAX host runs OpenVMS.
### END INIT INFO

NAME=simh
DAEMON=/usr/local/bin/start-vax-bg
PIDFILE=/var/run/simh.pid

test -f $DAEMON || exit 5
test -f $CONFIG || exit 5

. /lib/lsb/init-functions

case "$1" in
start)  log_daemon_msg "Starting VAX emulator" $NAME
        start-stop-daemon --start --pidfile $PIDFILE --name $NAME --exec $DAEMON
        log_end_msg $?
        ;;
stop)   log_daemon_msg "Stopping VAX emulator" "vax"
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --name vax
        log_end_msg $?
        ;;
status)
        status_of_proc -p $PIDFILE /usr/local/vax/vax vax && exit 0 || exit $?
        ;;
*)      log_action_msg "Usage: /etc/init.d/simh {start|stop|status}"
        exit 2
        ;;
esac
exit 0

So far I have managed to get it to start using 'simh start' and I can resume the screen session just fine. However, it's not creating a 'pid' file in /var/run so any attempts to stop it or check it's status ing that script fail.

I have a theory that it's because the script is spawning 2 processes;

 1076 ?        Ss     0:00 SCREEN -d -m -h 10000 /usr/local/vax/vax /etc/vax/config.ini
 1079 pts/2    Ssl+   0:00 /usr/local/vax/vax /etc/vax/config.ini

which are confusing the matter because the PID file only usually contains one process ID AFAIK.

Anyone got any feedback on this?

-- 

Mark Benson

http://DECtec.info
Twitter: @DECtecInfo
HECnet: STAR69::MARK

Online Resource & Mailing List for DEC Enthusiasts.




More information about the Simh mailing list