forked from MDSplus/mdsplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdsip_server
executable file
·44 lines (44 loc) · 1.16 KB
/
mdsip_server
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
40
41
42
43
44
#!/bin/sh
#
# MDSplus server daemon procedure
#
#
# Parameters:
#
# $1 = service or portnumber
# $2 = log directory (directory must exist)
# $3 = optional alternate mdsip.hosts file
# $4 = optional chroot directory
#
# This script can be invoked in /etc/inittab
# Add a line in your mdsip.hosts file used to assign an account to the special name "multi"
# to specify which account the long running server should run under:
#
# For example:
#
# multi | nobody
#
# In /etc/inittab you could add a line such as:
#
# m1:345:respawn:/usr/local/bin/mdsip_server 8010 /var/log/mdsplus/server-8010 /etc/mdsip.hosts
#
# After adding this line you can tell init to recheck the file using the command:
#
# # init q
#
if (test "$MDSPLUS_DIR" = "")
then
MDSPLUS_DIR=/usr/local/mdsplus
if ( test -r /etc/.mdsplus_dir )
then
MDSPLUS_DIR=`/bin/cat /etc/.mdsplus_dir`
fi
fi
. $MDSPLUS_DIR/setup.sh
mkdir -p $2
if (test "$4" = "")
then
exec $MDSPLUS_DIR/bin/mdsip -s -p $1 -h ${3:-/etc/mdsip.hosts} -c 9 >> $2/access 2>> $2/errors
else
/usr/sbin/chroot $4 $MDSPLUS_DIR/bin/mdsip -s -p $1 -h ${3:-/etc/mdsip.hosts} -c 9 >> $2/access 2>> $2/errors
fi