1 | #!/bin/sh -e |
---|
2 | # |
---|
3 | # Authors: Bas van der Vlies & Jaap Dijkshoorn |
---|
4 | # Desc. : Put a default torque file in /etc/default/torque |
---|
5 | # |
---|
6 | # SVN INFO: |
---|
7 | # $Id: postinst 2329 2006-09-21 10:12:53Z bas $ |
---|
8 | # |
---|
9 | |
---|
10 | SPOOLDIR=/var/spool/torque |
---|
11 | CONFIG_FILE=/etc/default/torque |
---|
12 | MKDIR="/usr/sbin/pbs_mkdirs" |
---|
13 | |
---|
14 | # Always check/create the directory structure |
---|
15 | # |
---|
16 | $MKDIR all |
---|
17 | |
---|
18 | # Also build the tclindexes again for xpbs xpbsmon |
---|
19 | # |
---|
20 | for file in xpbs xpbsmon |
---|
21 | do |
---|
22 | if [ -d /usr/lib/torque/$file ] |
---|
23 | then |
---|
24 | cd /usr/lib/torque/$file |
---|
25 | ./buildindex /usr/lib/torque/$file |
---|
26 | fi |
---|
27 | done |
---|
28 | |
---|
29 | # creating default file torque in /etc/default |
---|
30 | # |
---|
31 | create_default_torque_file() { |
---|
32 | cat > $CONFIG_FILE << EOF |
---|
33 | # |
---|
34 | # Author: Bas van der Vlies & Jaap Dijkshoorn |
---|
35 | # created with install of torque |
---|
36 | # |
---|
37 | # setting default to run pbs_mom. To enable an service |
---|
38 | # set the value to 1. |
---|
39 | # |
---|
40 | # |
---|
41 | PBS_MOM=1 |
---|
42 | PBS_SCHED=0 |
---|
43 | PBS_SERVER=0 |
---|
44 | |
---|
45 | PBS_MOM_OPTS='' |
---|
46 | PBS_SCHED_OPTS='' |
---|
47 | PBS_SERVER_OPTS='-a t' |
---|
48 | |
---|
49 | EOF |
---|
50 | } |
---|
51 | |
---|
52 | if [ ! -f $CONFIG_FILE ] |
---|
53 | then |
---|
54 | create_default_torque_file |
---|
55 | else |
---|
56 | # If old style config replace it we new one |
---|
57 | # |
---|
58 | OLD_CONFIG=`awk '/^HOST=/ { print $0 }' $CONFIG_FILE` |
---|
59 | if [ ! -z "$OLD_CONFIG" ] |
---|
60 | then |
---|
61 | create_default_torque_file |
---|
62 | fi |
---|
63 | fi |
---|
64 | |
---|
65 | # |
---|
66 | # make the spool directory an set mode bits. |
---|
67 | # |
---|
68 | if [ ! -d $SPOOLDIR/spool ] |
---|
69 | then |
---|
70 | mkdir $SPOOLDIR/spool |
---|
71 | fi |
---|
72 | chmod 1777 $SPOOLDIR/spool |
---|
73 | |
---|
74 | # Automatically added by dh_installinit |
---|
75 | if [ -x "/etc/init.d/torque" ]; then |
---|
76 | update-rc.d torque defaults >/dev/null |
---|
77 | if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then |
---|
78 | invoke-rc.d torque start || exit 0 |
---|
79 | else |
---|
80 | /etc/init.d/torque start || exit 0 |
---|
81 | fi |
---|
82 | fi |
---|
83 | # End automatically added section |
---|