ports/sysutils/torque/files/torque-config.in
Guido Falsi ac8c103656 - "Update" to 2.5.12. This is the supported stable branch upstream
- Bump PORTEPOCH
- Trim Makefile header
- Add CONFLICTS_INSTALL [1]
- Make rc scripts more rclint compliant
- Update WWW line in pkg-descr

PR:		ports/175063
Submitted by:	Jason Bacon <jwbacon@tds.net> (maintainer)
Approved by:	danfe (maintainer of games/qstat, via email) [1]
Approved by:	Kai Wang <kaiwang27@gmail.com> (maintainer of chinese/qterm) [1]
Feature safe:	yes
2013-04-16 18:23:45 +00:00

63 lines
1.6 KiB
Bash

#!/bin/sh -e
usage()
{
printf "Usage: $0 head|compute\n"
exit 1
}
if [ $# != 1 ]; then
usage
fi
node_type=$1
if [ $node_type != 'head' ] && [ $node_type != 'compute' ]; then
usage
fi
spool_root=/var/spool
if [ -e $spool_root/torque ]; then
printf "$spool_root/torque already exists. Aborting...\n"
exit 1
fi
cp -Rp %%PREFIX%%/share/examples/torque/var/spool/torque $spool_root
for dir in checkpoint spool undelivered; do
chmod 1777 $spool_root/torque/$dir
done
cat << EOM
===========================================================================
Enter the hostname of the torque server. This should be resolved by
/etc/hosts on all nodes. A short hostname is preferred.
===========================================================================
EOM
read server_hostname
echo $server_hostname > $spool_root/torque/server_name
case $node_type in
'head')
vi $spool_root/torque/server_priv/nodes
if ! fgrep -q 'pbs_server_enable="YES"' /etc/rc.conf; then
printf 'pbs_server_enable="YES"\n' >> /etc/rc.conf
fi
if ! fgrep -q 'pbs_sched_enable="YES"' /etc/rc.conf; then
printf 'pbs_sched_enable="YES"\n' >> /etc/rc.conf
fi
%%PREFIX%%/share/examples/torque/torque.setup root
%%PREFIX%%/etc/rc.d/pbs_server restart
%%PREFIX%%/etc/rc.d/pbs_sched restart
;;
'compute')
printf "Torque server IP address? "
read server_ip
printf '$pbsserver %s /var/spool/torque/mom_priv/config' $server_ip \
> $spool_root/torque/mom_priv/config
if ! fgrep -q 'pbs_mom_enable="YES"' /etc/rc.conf; then
printf 'pbs_mom_enable="YES"\n' >> /etc/rc.conf
fi
%%PREFIX%%/etc/rc.d/pbs_mom restart
;;
esac