forked from adaptivecomputing/torque
-
Notifications
You must be signed in to change notification settings - Fork 0
/
torque.setup
executable file
·83 lines (62 loc) · 1.82 KB
/
torque.setup
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
# torque.setup
# USAGE: torque.setup <USERNAME> [<HOSTNAME>]
if [ "$1" = "" ] ; then
echo "USAGE: torque.setup <USERNAME>"
exit 1
fi
unset PBSDEBUG
TRQ_CHECK=`pgrep trqauthd`
TRQ_CHECK_RES=$?
if [ "$TRQ_CHECK_RES" = "1" ]; then
TRQ_START=`trqauthd`
TRQ_START_RES=$?
if [ "$TRQ_START_RES" -ne "0" ]; then
echo "trqauthd failed to start!!! exiting setup"
exit 1
else
echo "trqauthd successfully started"
fi
fi
if [ "$2" = "" ] ; then
# obtain name obtained from reverse lookup of ip address
HOSTNAME=`hostname`
else
HOSTNAME=$2
fi
# enable operator privileges
USER=$1@$HOSTNAME
echo "initializing TORQUE (admin: $USER)"
ps -ef | grep -v grep | grep pbs_server
if [ "$?" -eq "0" ] ; then
echo "ERROR: pbs_server already running... run 'qterm' to stop pbs_server and rerun"
exit 1;
fi
pbs_server -t create
# Starting in TORQUE 3.1 the server is multi-threaded.
# We need to pause a second to allow the server to finish coming
# up. If we go to qmgr right away it will fail.
sleep 2
ps -ef | grep -v grep | grep pbs_server
if [ "$?" -ne "0" ] ; then
echo "ERROR: pbs_server failed to start, check syslog and server logs for more information"
exit 1;
fi
echo set server operators += $USER | qmgr
if [ "$?" -ne "0" ] ; then
echo "ERROR: cannot set TORQUE admins"
qterm
exit 1;
fi
echo set server managers += $USER | qmgr
qmgr -c 'set server scheduling = true'
qmgr -c 'set server keep_completed = 300'
qmgr -c 'set server mom_job_sync = true'
# create default queue
qmgr -c 'create queue batch'
qmgr -c 'set queue batch queue_type = execution'
qmgr -c 'set queue batch started = true'
qmgr -c 'set queue batch enabled = true'
qmgr -c 'set queue batch resources_default.walltime = 1:00:00'
qmgr -c 'set queue batch resources_default.nodes = 1'
qmgr -c 'set server default_queue = batch'