1 | #!/bin/bash |
---|
2 | |
---|
3 | ######## |
---|
4 | # 安裝 openPBS / torque |
---|
5 | ######## |
---|
6 | if [ ! -e torque-2.3.6.tar.gz ]; then |
---|
7 | wget wget http://www.clusterresources.com/downloads/torque/torque-2.3.6.tar.gz |
---|
8 | tar zxvf torque-2.3.6.tar.gz |
---|
9 | cd torque-2.3.6/ |
---|
10 | ./configure |
---|
11 | sudo make |
---|
12 | sudo make install |
---|
13 | # to make sure libtorque.so.2 is updated |
---|
14 | # or there will be an error message: |
---|
15 | # |
---|
16 | # pbs_mom: error while loading shared libraries: libtorque.so.2: cannot open shared object file: |
---|
17 | # No such file or directory |
---|
18 | # |
---|
19 | sudo ldconfig |
---|
20 | # create init.d scripts for torque |
---|
21 | sudo cp contrib/init.d/debian.pbs_mom /etc/init.d/pbs_mom |
---|
22 | sudo cp contrib/init.d/debian.pbs_sched /etc/init.d/pbs_sched |
---|
23 | sudo cp contrib/init.d/debian.pbs_server /etc/init.d/pbs_server |
---|
24 | fi |
---|
25 | |
---|
26 | sudo cat /etc/dhcp3/dhcpd.conf | grep "host .* {" | awk '{ print $2 }' > nodes |
---|
27 | sudo mv nodes /var/spool/torque/server_priv/nodes |
---|
28 | sudo pbs_server -t create |
---|
29 | cat > torque_conf << EOF |
---|
30 | create queue batch |
---|
31 | set queue batch queue_type = Execution |
---|
32 | set queue batch started = True |
---|
33 | set queue batch enabled = True |
---|
34 | set server default_queue = batch |
---|
35 | set server resources_default.nodes = 1 |
---|
36 | set server scheduling = True |
---|
37 | EOF |
---|
38 | sudo qmgr < torque_conf |
---|
39 | cat >> config << EOF |
---|
40 | \$pbsserver $(hostname) |
---|
41 | \$logevent 255 |
---|
42 | EOF |
---|
43 | sudo mv config /var/spool/torque/mom_priv/jobs/config |
---|
44 | sudo qterm -t quick |
---|
45 | sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf |
---|
46 | sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/server_priv/nodes /var/spool/torque/server_priv/nodes |
---|
47 | sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/mom_priv/jobs/config /var/spool/torque/mom_priv/jobs/config |
---|
48 | sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/pbs_environment /var/spool/torque/pbs_environment |
---|
49 | # enable pbs_mom service for DRBL Clients |
---|
50 | sudo /opt/drbl/sbin/drbl-client-service pbs_mom on |
---|
51 | # enable pbs_sched and pbs_server services for DRBL Server |
---|
52 | sudo update-rc.d pbs_sched defaults |
---|
53 | sudo update-rc.d pbs_server defaults |
---|