source: drbl-biocluster/drbl-torque.sh @ 192

Last change on this file since 192 was 167, checked in by jazz, 14 years ago
  • Property svn:executable set to *
File size: 2.6 KB
RevLine 
[104]1#!/bin/bash
2
3########
4# 安裝 openPBS / torque
5########
6if [ ! -e torque-2.3.6.tar.gz ]; then
[163]7  wget http://www.clusterresources.com/downloads/torque/torque-2.3.6.tar.gz
[104]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
24fi
25
26sudo cat /etc/dhcp3/dhcpd.conf | grep "host .* {" | awk '{ print $2 }' > nodes
27sudo mv nodes /var/spool/torque/server_priv/nodes
28sudo pbs_server -t create
29cat > torque_conf << EOF
30create queue batch
31set queue batch queue_type = Execution
32set queue batch started = True
33set queue batch enabled = True
34set server default_queue = batch
35set server resources_default.nodes = 1
36set server scheduling = True
37EOF
[166]38for i in `cat /var/spool/torque/server_priv/nodes`
39do
40    echo "set server submit_hosts += $i" >> torque_conf
41done
[104]42sudo qmgr < torque_conf
43cat >> config << EOF
44\$pbsserver    $(hostname)
45\$logevent     255
[164]46\$usecp *:/home /home
[104]47EOF
48sudo mv config /var/spool/torque/mom_priv/jobs/config
[163]49# terminate pbs_server and pbs_schedule
[104]50sudo qterm -t quick
[163]51sudo /etc/init.d/pbs_sched stop
52# re-deploy DRBL
[104]53sudo /opt/drbl/sbin/drblpush -c /etc/drbl/drblpush.conf
[163]54# copy torque related configuration files for pbs_mom
[104]55sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/server_priv/nodes /var/spool/torque/server_priv/nodes
56sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/mom_priv/jobs/config /var/spool/torque/mom_priv/jobs/config
57sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/pbs_environment /var/spool/torque/pbs_environment
[163]58sudo /opt/drbl/sbin/drbl-cp-host /var/spool/torque/server_name /var/spool/torque/server_name
[104]59# enable pbs_mom service for DRBL Clients
60sudo /opt/drbl/sbin/drbl-client-service pbs_mom on
61# enable pbs_sched and pbs_server services for DRBL Server
62sudo update-rc.d pbs_sched defaults
63sudo update-rc.d pbs_server defaults
[164]64# sync. cluster time
[166]65sudo /opt/drbl/bin/drbl-doit ntpdate 0.debian.pool.ntp.org
[163]66# restart pbs_sched and pbs_server
67sudo /etc/init.d/pbs_sched start
68sudo /etc/init.d/pbs_server start
69# start pbs_mom
[166]70sudo /opt/drbl/bin/drbl-doit /etc/init.d/pbs_mom start
[167]71# check if /etc/hosts have more than one hostname
72echo "[32m please check if /etc/hosts have lots of hostname[0m"
73grep $(hostname) /etc/hosts
Note: See TracBrowser for help on using the repository browser.