File: run_daemon

package info (click to toggle)
msql 2.0.3-5
  • links: PTS
  • area: non-free
  • in suites: hamm, slink
  • size: 3,596 kB
  • ctags: 2,483
  • sloc: ansic: 34,769; sh: 1,309; yacc: 1,084; perl: 328; makefile: 267
file content (39 lines) | stat: -rwxr-xr-x 857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
#
# Because this stuff is still pretty young, you may wish to run the
# server using this script.  It'll notify if the server crashes and
# restart it after a couple of minutes.  It also puts the core in a known
# place and mails you any output generated by the terminal process.
#
# run it as  'run_daemon msqld' to run the mSQL engine.
#
#					bambi@Bond.edu.au

INST_DIR=/usr/local/Minerva
ADMIN="you@some.machine"
PROG=$1

if test ! -d "${INST_DIR}/debug"
then
	mkdir ${INST_DIR}/debug
fi

if test ! -d "${INST_DIR}/debug/${PROG}"
then
	mkdir ${INST_DIR}/debug/${PROG}
fi

while :
do
	cd ${INST_DIR}/debug/${PROG}
	${INST_DIR}/bin/${PROG} > output 2>&1
	echo "Program : ${PROG}
Time : `date`
Program Output
--------------

" > mail.tmp
	cat output >> mail.tmp
	/usr/ucb/mail -s "Minerva Daemon Crash Report" ${ADMIN} < mail.tmp
	sleep 15
done