Nathan Russell wrote:

> Hi,
>
> I was wondering if anyone knows of a script to shut down mprime and make
> sure the save files are finished saving before SIGKILL is sent in the
> shutdown process.
>

Hi I use an sysv type init and start and stop the mersenne
from the rc.d directory.
The script is as follows:

(/etc/rc.d/init.d/mersenne, added to the respective rc.n directories with
chkconfig)

#!/bin/sh
#
# mersenne
#
# chkconfig: 2345 10 50
# description: mersenne
#

# Source function library.
. /etc/init.d/functions


# See how we were called.
case "$1" in
  start)
 action "Starting mersenne: " su - -c /home/mersenne/startmprime mersenne
touch /var/lock/subsys/mersenne
 ;;
  stop)
 action "Stopping Mersenne" killall mprime
 rm -f /var/lock/subsys/mersenne
 ;;
  restart|reload)
 $0 stop;
 $0 start;
 ;;
  *)
 # do not advertise unreasonable commands that there is no reason
 # to use with this device
 echo "Usage: mersenne {start|stop|restart|reload}"
 exit 1
esac

exit 0

the /home/mersenne/startmprime script is as follows:
#!/bin/bash
cd /home/mersenne
./mprime -B -A0
./mprime -B -A1


By killing it relatively early in the shutdown sequence I know for sure that

mprime has enough time to shut down before the generic kills are sent.
(kill and killall sends SIGTERM by default)

Kind Regards, Martijn

>
> In terms of starting it up, I now have a line in my inittab file to
> start it whenever the system enters runlevel 5, and run it with runtime
> options to use the Prime95 directory of the Windows drive as its working
> directory.  It is set up to run setuid a user, and I've checked and it
> is indeed running as that user.
>
> Thanks!
>
> Nathan
> _________________________________________________________________________
> Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm
> Mersenne Prime FAQ      -- http://www.tasam.com/~lrwiman/FAQ-mers


_________________________________________________________________________
Unsubscribe & list info -- http://www.scruz.net/~luke/signup.htm
Mersenne Prime FAQ      -- http://www.tasam.com/~lrwiman/FAQ-mers

Reply via email to