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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463
|
#!/bin/sh
#
# Grid Engine configuration script (Installation/Uninstallation/Upgrade/Downgrade)
# Scriptname: inst_sge
#
#___INFO__MARK_BEGIN__
##########################################################################
#
# The Contents of this file are made available subject to the terms of
# the Sun Industry Standards Source License Version 1.2
#
# Sun Microsystems Inc., March, 2001
#
#
# Sun Industry Standards Source License Version 1.2
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.2 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2001 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
#
# set -x
SCRIPT_VERSION="6"
SGE_VERSION="6.2"
#Reset PATH to a safe value
#
SAVED_PATH=$PATH
PATH=/bin:/usr/bin:/usr/sbin:/usr/bsd:/usr/ucb
# Easy way to prevent clearing of screen
#
CLEAR=clear
# The same as clear!
#
ECHO=echo
# Sourcing common function module
#
PWD=`pwd`
. ./util/arch_variables
. ./util/install_modules/inst_common.sh
#---------------------------------------
# commandline argument parsing
#---------------------------------------
UPDATE=false
DOWNGRADE=false
BACKUP=false
RESTORE=false
AUTO=false
RESCHEDULE=true
RESPORT=false
CSP=false
SGE_ENABLE_JMX=false
AFS=false
NOREMOTE=false
START_RPC_SERVICE=false
ADD_TO_RC=false
SET_FILE_PERMS=false
MAKE_RC=false
ADD_RC=false
REMOVE_RC=false
UPDATE_RC=false
UPDATE_WIN=false
DEL_EXECD_SPOOL=false
POST_UPDATE=false
WIN_UPDATE=false
COPY_CA="false"
RECREATE_SETTINGS="false"
USE_OLD_IJS="false"
START_CLUSTER="false"
QMASTER="undef"
EXECD="undef"
SHADOW="undef"
BERKELEY="undef"
SUBMIT="undef"
TAR="undef"
FILE="undef"
HOST="undef"
HOSTRANGE="undef"
LOCAL_EXECD_SPOOL="undef"
SHELL_NAME="ssh"
COPY_COMMAND="scp"
EXEC_HOST_LIST="undef"
CONFIG_FILE="undef"
STDOUT2LOG="0"
PAR_EXECD_INST_COUNT="20"
JAVA_VERSION="undef"
WIN_SVC="undef"
SGE_NOMSG="undef"
WINDOWS_SUPPORT="false"
WIN_DOMAIN_ACCESS="false"
WIN_ADMIN_NAME="Administrator"
CSP_RECREATE="false"
CSP_COPY_CERTS="false"
CSP_COUNTRY_CODE="undef"
CSP_STATE="undef"
CSP_LOCATION="undef"
CSP_ORGA="undef"
CSP_ORGA_UNIT="undef"
CSP_MAIL_ADDRESS="undef"
CERT_COPY_HOST_LIST="undef"
SERVICE_TAGS="enable"
SGE_ENABLE_SMF="true"
#Save changed host names during resolving
RESOLVED_CHANGED_HOSTNAMES=""
#init global variables, need for port setting
execd_service="false"
qmaster_service="false"
BasicSettings
SetUpInfoText
PreInstallCheck
ARGC=$#
if [ $ARGC = 0 ]; then
ErrUsage
exit 2
fi
while [ $ARGC != 0 ]; do
case $1 in
-auto)
AUTO="true"
FILE="$2"
if [ ! -f "$2" ]; then
ErrUsage
fi
shift
ARGC=`expr $ARGC - 1`
#Stdout2Log
CheckPath
;;
-m)
QMASTER="install"
. ./util/install_modules/inst_qmaster.sh
. ./util/install_modules/inst_berkeley.sh
. ./util/install_modules/inst_st.sh
;;
-um)
QMASTER="uninstall"
. ./util/install_modules/inst_qmaster_uninst.sh
. ./util/install_modules/inst_st.sh
;;
-x)
EXECD="install"
. ./util/install_modules/inst_execd.sh
if [ "$2" = "-upd" ]; then
UPDATE="true"
shift
ARGC=`expr $ARGC - 1`
fi
;;
-ux)
EXECD="uninstall"
if [ "$2" = "all" ]; then
ALL_EXECDS="true"
shift
ARGC=`expr $ARGC - 1`
fi
. ./util/install_modules/inst_execd.sh
. ./util/install_modules/inst_execd_uninst.sh
. ./util/install_modules/inst_qmaster.sh
;;
-sm)
SHADOW="install"
. ./util/install_modules/inst_qmaster.sh
. ./util/install_modules/inst_execd.sh
#echo Install Shadowhost
;;
-usm)
SHADOW="uninstall"
#echo uninstall Shadowhost
;;
-db)
BERKELEY="install"
SPOOLING_SERVER=`hostname`
. ./util/install_modules/inst_qmaster.sh
. ./util/install_modules/inst_berkeley.sh
;;
-udb)
BERKELEY="uninstall"
SPOOLING_SERVER=`hostname`
. ./util/install_modules/inst_qmaster.sh
. ./util/install_modules/inst_berkeley.sh
;;
-s)
#add a submit host and copy ca certs if needed
SUBMIT="install"
. ./util/install_modules/inst_qmaster.sh
. ./util/install_modules/inst_execd.sh
;;
-host)
if [ $AUTO = "false" -a $QMASTER = "install" ]; then
EXEC_HOST_LIST=$2
else
HOST=$2
fi
shift
ARGC=`expr $ARGC - 1`
;;
-bup)
BACKUP=true
#do configuration database backup
;;
-rst)
RESTORE=true
#restore a backuped database
;;
-upd)
#update from 6.0 or higher to 6.2
UPDATE=true
QMASTER="install"
. ./util/install_modules/inst_qmaster.sh
. ./util/install_modules/inst_berkeley.sh
. ./util/install_modules/inst_st.sh
. ./util/upgrade_modules/inst_upgrade.sh
;;
-post-upd)
POST_UPDATE=true
. ./util/install_modules/inst_common.sh
. ./util/upgrade_modules/inst_upgrade.sh
;;
-upd-execd)
ALL_RC=true
DEL_EXECD_SPOOL=true
. ./util/install_modules/inst_common.sh
. ./util/upgrade_modules/inst_upgrade.sh
;;
-upd-win)
UPDATE_WIN=true
. ./util/install_modules/inst_common.sh
. ./util/upgrade_modules/inst_upgrade.sh
;;
-upd-rc)
UPDATE_RC=true
ALL_RC=true
RC_VERSION="61"
REMOVE_RC=true
ADD_RC=true
;;
-start-all)
START_CLUSTER=true
. ./util/install_modules/inst_common.sh
;;
-winupdate)
#update to new Gridengine Helper Service
WIN_UPDATE="true"
. ./util/install_modules/inst_common.sh
. ./util/install_modules/inst_execd.sh
;;
-winsvc)
#install the windows helper service only
WIN_SVC="install"
. ./util/install_modules/inst_common.sh
. ./util/install_modules/inst_execd.sh
;;
-uwinsvc)
#uninstall the windows helper service only
WIN_SVC="uninstall"
. ./util/install_modules/inst_common.sh
. ./util/install_modules/inst_execd.sh
;;
-rccreate)
MAKE_RC=true
#Generate new rc scripts from settings file
;;
-noremote)
NOREMOTE=true
#Disable remote installation
;;
-rsh)
SHELL_NAME=rsh
;;
-nr)
RESCHEDULE=false
#echo set reschedule to false
;;
-resport)
RESPORT=true
#echo set resport to true
;;
-csp)
CSP=true
;;
-jmx)
SGE_ENABLE_JMX=true
;;
-copycerts)
if [ "$2" = "" ]; then
ErrUsage
fi
#copy ca certs to the given hosts
COPY_CA="true"
shift
CERT_COPY_HOST_LIST=$*
ARGC=`expr $ARGC - 1`
;;
-oldijs)
USE_OLD_IJS="true"
;;
-afs)
AFS=true
;;
-v)
$ECHO "Software version: $SGE_VERSION"
exit 0
;;
-nosmf)
SGE_ENABLE_SMF="false"
SMF_FLAGS="-nosmf"
;;
-help)
ErrUsage
;;
*)
option=$1
ErrUsage
;;
esac
shift
ARGC=`expr $ARGC - 1`
done
CheckForSMF
if [ $AUTO = "false" -a $QMASTER = "undef" -a $EXECD = "install" -a $SHADOW = "install" ]; then
ErrUsage
fi
#checking the autoinstall configuration file at this point of installation,
#because the commandline switches are completely parsed and we know the selected options.
#This will influence the configfile parsing and checking mechanism.
if [ $AUTO = "true" ]; then
GetConfigFromFile
CheckConfigFile $FILE
fi
$CLEAR
if [ $USE_OLD_IJS = "false" ]; then
QLOGIN_DAEMON="builtin"
QLOGIN_COMMAND="builtin"
RLOGIN_DAEMON="builtin"
RLOGIN_COMMAND="builtin"
RSH_DAEMON="builtin"
RSH_COMMAND="builtin"
fi
if [ "$START_CLUSTER" = true ]; then
if [ -z "$SGE_ROOT" -o -z "$SGE_CELL" ]; then
$INFOTEXT "\Can't start cluster: $SGE_ROOT and \$SGE_CELL must be set!"
exit 2
fi
ALL_RC=true
ManipulateOneDaemonType "" bdb ""
ManipulateOneDaemonType "" qmaster ""
ManipulateOneDaemonType "" execd ""
exit
fi
if [ "$WIN_UPDATE" = "true" ]; then
WelcomeTheUserWinUpdate
SetupWinSvc update #service install due to an update -> param: update
# don't exit but continue with installation of execution daemon
fi
if [ "$WIN_SVC" = "install" ]; then
WelcomeTheUserWinSvc install #install text param
SetupWinSvc install #service install due to service install switch -> param install
# don't exit but continue with installation of execution daemon
fi
if [ "$WIN_SVC" = "uninstall" ]; then
WelcomeTheUserWinSvc uninstall #uninstall text param
SetupWinSvc uninstall #service install due to service uninstall switch -> param uninstall
# don't exit but continue with uninstallation of execution daemon
fi
#Upgrade from 6.0+ to 6.2
if [ "$UPDATE" = true ]; then
AUTO=false
EXECD=undef
SHADOW=undef
BERKELEY=undef
DBWRITER=undef
LicenseAgreement
WelcomeTheUserUpgrade
#Ask for backup_dir
GetBackupDirectory
#Old rc scripts must be long gone!
#Source sge_root, sge_cell, qmaster, execd port from the backup
SGE_ROOT=`pwd | sed 's/\/tmp_mnt//'`
bck_sge_root=`cat "${UPGRADE_BACKUP_DIR}/sge_root" | awk -F= '{print $2}' | awk -F\; '{print $1}' 2>/dev/null`
. "${UPGRADE_BACKUP_DIR}/sge_cell"
bck_sge_cell=`cat "${UPGRADE_BACKUP_DIR}/sge_cell" | awk -F= '{print $2}' | awk -F\; '{print $1}' 2>/dev/null`
. "${UPGRADE_BACKUP_DIR}/ports"
CheckForLocalHostResolving
ProcessSGERoot
QMASTER=undef
SGE_CELL=$bck_sge_cell #to get sge_cell backup value as default
GetCell
QMASTER=install
euid=`$SGE_UTILBIN/uidgid -euid`
#Real upgrade from 6.0+ to 6.2 from here (same SGE_ROOT,SGE_CELL)
if [ "$SGE_ROOT" = "$bck_sge_root" -a "$SGE_CELL" = "$bck_sge_cell" ]; then
UPGRADE_MODE="upgrade"
#Stop if not a qmaster host
tmp_master=`cat "$UPGRADE_BACKUP_DIR/cell/act_qmaster" 2>/dev/null`
tmp_master2=`grep "^${HOST}#" "$UPGRADE_BACKUP_DIR/cell/shadow_masters" 2>/dev/null`
if [ "$tmp_master" != "$HOST" -a "$tmp_master2" != "$HOST" ]; then
$INFOTEXT "Upgrade must be started on a qmaster host!"
exit 2
fi
if [ ! -d "$SGE_ROOT/$SGE_CELL" ]; then
UPGRADE_MODE="copy"
elif [ ! -f "$SGE_ROOT/$SGE_CELL/common/bootstrap" ]; then
$INFOTEXT -n "Cannot continue with the \"real\" upgrade procedure because the \n" \
"installation is corrupted. There is no bootstrap file in the \n" \
"%s directory.\n" \
"Restart the upgrade and choose a different <sge_root> or \n" \
"<sge_cell> value.\n" "$SGE_ROOT/$SGE_CELL/common"
exit 2
fi
elif [ -f "$SGE_ROOT/$SGE_CELL/common/bootstrap" ]; then
$INFOTEXT -n "Bootstrap file already exists in selected <sge_root>/<sge_cell>.\n" \
"If you want to copy the configuration to this location, delete \n" \
"%s directory \n" \
"and restart the upgrade.\n" "$SGE_ROOT/$SGE_CELL"
exit 2
fi
if [ "$UPGRADE_MODE" != "upgrade" ]; then
#Just copy the configuration to a new SGE_CELL
UPGRADE_MODE="copy"
if [ -n "$SGE_QMASTER_PORT" ]; then
SGE_QMASTER_PORT=`expr $SGE_QMASTER_PORT + 2`
fi
GetQmasterPort
if [ -n "$SGE_EXECD_PORT" ]; then
SGE_EXECD_PORT=`expr $SGE_EXECD_PORT + 2`
fi
GetExecdPort
else
#UPGRADE MODE
#Backup could be created with /etc/services values, (not saved) we rather ask for new value
if [ -z "$SGE_QMASTER_PORT" ]; then
GetQmasterPort
fi
if [ -z "$SGE_EXECD_PORT" ]; then
GetExecdPort
fi
fi
SetCellDependentVariables
if [ "$UPGRADE_MODE" = upgrade ]; then
#Get backuped admin user
GetBackupedAdminUser
OLD_ADMIN_USER=$ADMIN_USER
GetAdminUser #Get current admin user of the cluster
CheckUpgradeUser #Stop if admin user mismatch (backup vs. current cluster)
#Detect spool dir from the backup
QMDIR=`BootstrapGetValue $SGE_ROOT/$SGE_CELL/common "qmaster_spool_dir"`
else
CheckWhoInstallsSGE
#Ask for new QMaster spool dir
GetQmasterSpoolDir $euid
fi
#TODO: Check if no jobs. qmaster.pid?
SGE_CLUSTER_NAME=`cat "$SGE_ROOT/$SGE_CELL/common/cluster_name" 2>/dev/null`
if [ -z "$SGE_CLUSTER_NAME" -a -f "$UPGRADE_BACKUP_DIR/cell/cluster_name" ]; then
SGE_CLUSTER_NAME=`cat "$UPGRADE_BACKUP_DIR/cell/cluster_name" 2>/dev/null`
fi
if [ "$UPGRADE_MODE" = copy ]; then
if [ -f "$SGE_ROOT/$SGE_CELL/common/cluster_name" ]; then
ExecuteAsAdmin rm -f "$SGE_ROOT/$SGE_CELL/common/cluster_name"
fi
SGE_CLUSTER_NAME="" #delete environment, we want a new default
fi
if [ -z "$SGE_CLUSTER_NAME" ]; then
ProcessSGEClusterName qmaster
fi
if [ -f "$UPGRADE_BACKUP_DIR/win_hosts" ]; then
WINDOWS_SUPPORT=true
WindowsDomainUserAccess
ExecuteAsAdmin cp "$UPGRADE_BACKUP_DIR/win_hosts" "$SGE_ROOT/$SGE_CELL/win_hosts_to_update"
fi
SetPermissions
#Detect the product mode
PRODUCT_MODE=`BootstrapGetValue ${UPGRADE_BACKUP_DIR}/cell "security_mode"`
if [ "$UPGRADE_MODE" = "copy" ]; then
case $PRODUCT_MODE in
csp)
CSP=true
;;
afs)
AFS=true
;;
esac
SetProductMode
else
#We don't care about switches, setup is going to be reused
CSP=false
AFS=false
fi
#Find out if jmx should be used from the backup
RestoreJMX "${UPGRADE_BACKUP_DIR}/cell/jmx"
#Load and upgrade old cell
RestoreCell "${UPGRADE_BACKUP_DIR}/cell"
GetJMXPort
if [ -d "$QMDIR" ]; then
ExecuteAsAdmin rm -rf "$QMDIR/*" # remove old qmaster spool dir
fi
Makedir $QMDIR/job_scripts # create a new one
if [ "$UPGRADE_MODE" = upgrade ]; then
SelectNewSpooling `BootstrapGetValue "${UPGRADE_BACKUP_DIR}/cell" "spooling_method"`
else
SetSpoolingOptions
ReplaceLineWithMatch "$SGE_ROOT/$SGE_CELL/common/bootstrap" 644 'spooling_method.*' "spooling_method $SPOOLING_METHOD"
ReplaceLineWithMatch "$SGE_ROOT/$SGE_CELL/common/bootstrap" 644 'spooling_lib.*' "spooling_lib $SPOOLING_LIB"
ReplaceLineWithMatch "$SGE_ROOT/$SGE_CELL/common/bootstrap" 644 'spooling_params.*' "spooling_params $SPOOLING_ARGS"
fi
InitSpoolingDatabase
ServiceTagsSupport
SavedOrNewIJS
AddDummyConfiguration #Create a new configuration to be able to start qmaster
AddActQmaster #Always overwrite backup settings with current host
if [ "$UPGRADE_MODE" = copy ]; then
PrepareConfiguration
else #Upgrade: Just reset variables to be safe
CFG_EXE_SPOOL=""
CFG_MAIL_ADDR=""
CFG_GID_RANGE=""
fi
AddJMXFiles
RestoreSequenceNumberFiles $QMDIR #Restore jobseqnum and arseqnum
CreateSGEStartUpScripts $euid true master
CreateSGEStartUpScripts $euid true execd
CreateSettingsFile
InitCA
SetupRcScriptNames master #New qmaster RC script/SMF
InstallRcScript
#TODO: Need to ensure there is no qmaster on the same port running
StartQmaster
CopyCA execd
CopyCA submit
CheckRunningDaemon sge_qmaster
$INFOTEXT -u "Last step - load configuration from the backup"
$INFOTEXT -n "\nload command: $SGE_ROOT/util/upgrade_modules/load_sge_config.sh $UPGRADE_BACKUP_DIR -mode \"$UPGRADE_MODE\" -log C -newijs \"$newIJS\" -gid_range \"${CFG_GID_RANGE}\" -admin_mail \"${CFG_MAIL_ADDR}\" -execd_spool_dir \"${CFG_EXE_SPOOL}\" \n"
$INFOTEXT -wait -auto $AUTO -n "\nHit <RETURN> to continue >> "
#Load configuration, show only critical errors
"$SGE_ROOT/util/upgrade_modules/load_sge_config.sh" "$UPGRADE_BACKUP_DIR" -log "C" -mode "$UPGRADE_MODE" \
-newijs "$newIJS" -execd_spool_dir "$CFG_EXE_SPOOL" -gid_range "$CFG_GID_RANGE" -admin_mail "$CFG_MAIL_ADDR"
if [ "$POST_UPDATE" != true ]; then
$INFOTEXT -n "\nIf loading the configuration succeeded run these additional commands:\n" \
"REQUIRED:\n" \
"inst_sge -upd-execd\n" \
" This command initializes all execd spool directories.\n"
if [ "$WINDOWS_SUPPORT" = true ]; then
$INFOTEXT -n "inst_sge -upd-win\n" \
" This command connects to all Windows execution hosts and installs \n" \
" the new Windows helper service on each host.\n" \
" WARNING: If a helper service from a previous release is running \n" \
" on this host, the new helper service overwrites it. The \n" \
" host will run only in a 6.2 cluster.\n" \
" TIP: This action requires to enter a windows administrator user for each \n" \
" host interactively. If all your systems share the same administrator you \n" \
" can set the environment variable SGE_WIN_ADMIN to that user name. \n" \
" E.g.: (sh, bash) export SGE_WIN_ADMIN=Administrator \n" \
" (csh,tcsh) setenv SGE_WIN_ADMIN Administrator \n"
fi
$INFOTEXT -n "OPTIONAL:\n" \
"inst_sge -upd-rc\n" \
" This command creates new autostart scripts for the new cluster\n" \
" and removes any conflicting files.\n" \
" TIP: To disable SMF on Solaris systems, use the command\n" \
" inst_sge -upd-rc -nosmf\n" \
"\n" \
"TIP: Use inst_sge -post-upd to do all above actions\n"
exit 0
fi
fi
if [ "$POST_UPDATE" = true ]; then
if [ -z "$SGE_ROOT" -o -z "$SGE_CELL" ]; then
$INFOTEXT "\$SGE_ROOT and \$SGE_CELL must be set!"
exit 2
fi
ALL_RC=true #Do all hosts
ADD_RC=false
REMOVE_RC=false
DEL_EXECD_SPOOL=true
#Delete (create) execd spool dirs
ManipulateOneDaemonType "" execd ""
DEL_EXECD_SPOOL=false
REMOVE_RC=true
#Remove all old RC scripts
ManipulateOneDaemonType "" qmaster "61"
ManipulateOneDaemonType "" execd "61"
ManipulateOneDaemonType "" bdb "61"
REMOVE_RC=false
ADD_RC=true
#Add new rc scripts for whole cluster
ManipulateOneDaemonType "" bdb ""
ManipulateOneDaemonType "" qmaster ""
ManipulateOneDaemonType "" execd ""
#Update win hosts if appropriate
list=""
if [ -f "$SGE_ROOT/$SGE_CELL/win_hosts_to_update" ]; then
list=`cat $SGE_ROOT/$SGE_CELL/win_hosts_to_update 2>/dev/null`
else
exit 0
fi
if [ -z "$list" ]; then
$INFOTEXT -log "Cannot upgrade Windows helper service because there are no Windows\n" \
"hosts in the backup."
exit 2
fi
ALL_RC=false
ManipulateOneDaemonType $list execd ""
$INFOTEXT -log "After you verify that your Windows hosts work, delete \n%s file." "$SGE_ROOT/$SGE_CELL/win_hosts_to_update"
exit
fi
#Delete all execd_spool dirs / create non-existing ones
if [ "$DEL_EXECD_SPOOL" = true ]; then
ManipulateOneDaemonType "" execd ""
if [ "$UPDATE_RC" != true -a "$UPDATE_WIN" != true ]; then
exit
fi
fi
#Remove old RC and install new
if [ "$UPDATE_RC" = true ]; then
ManipulateOneDaemonType "" qmaster "61"
ManipulateOneDaemonType "" execd "61"
ManipulateOneDaemonType "" bdb "61"
if [ "$UPDATE_WIN" != true ]; then
exit
fi
fi
#Remove old RC and install new
if [ "$UPDATE_WIN" = true ]; then
if [ -z "$SGE_ROOT" -o -z "$SGE_CELL" ]; then
$INFOTEXT "\$SGE_ROOT and \$SGE_CELL must be set!"
exit 2
fi
list=""
if [ -f "$SGE_ROOT/$SGE_CELL/win_hosts_to_update" ]; then
list=`cat $SGE_ROOT/$SGE_CELL/win_hosts_to_update 2>/dev/null`
fi
if [ -z "$list" ]; then
$INFOTEXT -log "Cannot upgrade Windows helper service because there are no Windows\n" \
"hosts in the backup."
exit 2
fi
ALL_RC=false
ManipulateOneDaemonType $list execd ""
$INFOTEXT -log "After you verify that your Windows hosts work, delete \n%s file." "$SGE_ROOT/$SGE_CELL/win_hosts_to_update"
exit
fi
if [ "$BERKELEY" = "install" ]; then
if [ "$AUTO" = "true" ]; then
Stdout2Log
$INFOTEXT -log "Starting Berkeley DB installation!"
fi
if [ "$DB_SPOOLING_SERVER" = "" -o "$HOST" = "$DB_SPOOLING_SERVER" -o "$NOREMOTE" = "true" ]; then
CheckWhoInstallsSGE
ProcessSGERoot
GetCell
COMMONDIR=$SGE_CELL/common
Makedir $SGE_CELL
Makedir $COMMONDIR
ProcessSGEClusterName "bdb"
SetSpoolingOptions
AddSGEStartUpScript $euid "bdb"
PrepareRPCServerStart
GiveBerkelyHints
else
$INFOTEXT -log "remote berkeley rpc server installation on host %s" $DB_SPOOLING_SERVER
echo "cd $SGE_ROOT && ./inst_sge -db -auto $FILE -noremote $SMF_FLAGS" | $SHELL_NAME $DB_SPOOLING_SERVER /bin/sh &
sleep 5
fi
BERKELEY="undef"
fi
if [ "$QMASTER" = "install" -a "$UPDATE" != "true" ]; then
is_master="true"
if [ "$AUTO" = "true" ]; then
Stdout2Log
$INFOTEXT -log "Starting qmaster installation!"
fi
LicenseAgreement
WelcomeTheUser
CheckForLocalHostResolving
CheckWhoInstallsSGE
ProcessSGERoot
GetQmasterPort
GetExecdPort
GetCell
ProcessSGEClusterName qmaster
GetQmasterSpoolDir $euid
SetCellDependentVariables
WindowsSupport
SetPermissions
SelectHostNameResolving
SetProductMode
GetJMXPort
MakeDirsMaster
SetSpoolingOptions
AddBootstrap
InitSpoolingDatabase
ServiceTagsSupport
AddConfiguration
AddLocalConfiguration
AddActQmaster
AddDefaultComplexes
AddPEFiles
AddDefaultUsersets
AddCommonFiles
AddJMXFiles
CreateSGEStartUpScripts $euid true master
CreateSGEStartUpScripts $euid true execd
CreateSettingsFile
InitCA
AddSGEStartUpScript $euid master
StartQmaster
AddWindowsAdmin
AddHosts
CopyCA execd
CopyCA submit
SetScheddConfig
GiveHints
CheckRunningDaemon sge_qmaster
if [ $? = 0 ]; then
$INFOTEXT "sge_qmaster successfully installed!\n"
$INFOTEXT -log "sge_qmaster successfully installed!\n"
MoveLog
$CLEAR
else
$INFOTEXT "sge_qmaster not successfully installed!\n"
$INFOTEXT -log "sge_qmaster not successfully installed!\n"
MoveLog
exit 1
fi
fi
if [ "$EXECD" = "install" -a "$UPDATE" != "true" ]; then
if [ "$AUTO" = "true" ]; then
inst_counter=0
install_is_done="false"
max_retries=20
Stdout2Log
LogResolvedHostLists
. $SGE_ROOT/$SGE_CELL/common/settings.sh
if [ -f "$SGE_ROOT/$SGE_CELL/common/bootstrap" ]; then
ignore_fqdn=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep "ignore_fqdn" | awk '{ print $2 }'`
default_domain=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep "default_domain" | awk '{ print $2 }'`
fi
EXEC_HOSTS_TO_INSTALL=$EXEC_HOST_LIST
EXEC_HOSTS_TO_INSTALL_TMP=$EXEC_HOSTS_TO_INSTALL
CURRENTLY_INSTALLING_HOSTS=""
INSTALLED_EXEC_HOSTS=""
FAILED_EXEC_HOSTS=""
while [ "$install_is_done" = "false" ]; do #looping as long as installation is not done
for hti in $EXEC_HOSTS_TO_INSTALL; do # looping over all host in this list, again and againg, till
# EXEC_HOSTS_TO_INSTALL list is empty
if [ "$NOREMOTE" = "false" ]; then
LOCALINST="false" # in this case the installation has to be executed on any remote host.
ExecdAlreadyInstalled $hti
installed=$?
currently_running="false"
for runnings in $CURRENTLY_INSTALLING_HOSTS; do
if [ "$runnings" = "$hti" ]; then # check if the currently selected host is already installing
currently_running="true"
break
fi
done
if [ "$installed" = 0 -a "$currently_running" = "false" ]; then #if not installed and not installing, do this
if [ $hti = `$SGE_UTILBIN/gethostname -aname` ]; then
$INFOTEXT -log "local execd installation on host %s" $hti #the selected host is the local host, start
qconf -ah $hti #installation without rsh/ssh
./inst_sge -x $SMF_FLAGS -auto $FILE -noremote &
inst_counter=`expr $inst_counter + 1`
CURRENTLY_INSTALLING_HOSTS="$CURRENTLY_INSTALLING_HOSTS $hti"
EXEC_HOSTS_TO_INSTALL_TMP=`RemoveHostFromList "$EXEC_HOSTS_TO_INSTALL_TMP" "$hti"`
else
CheckRSHConnection $hti
if [ "$?" = 0 ]; then
#host is remote, start installation via rsh/ssh
$INFOTEXT -log "remote execd installation on host %s" $hti
qconf -ah $hti
echo ". $SGE_ROOT/$SGE_CELL/common/settings.sh; cd $SGE_ROOT && ./inst_sge -x $SMF_FLAGS -auto $FILE -noremote" | $SHELL_NAME $hti /bin/sh &
inst_counter=`expr $inst_counter + 1`
CURRENTLY_INSTALLING_HOSTS="$CURRENTLY_INSTALLING_HOSTS $hti"
EXEC_HOSTS_TO_INSTALL_TMP=`RemoveHostFromList "$EXEC_HOSTS_TO_INSTALL_TMP" "$hti"`
else
#host is remote, start installation via rsh/ssh
$INFOTEXT -log "rsh/ssh connection to host %s is not working" $hti
EXEC_HOSTS_TO_INSTALL_TMP=`RemoveHostFromList "$EXEC_HOSTS_TO_INSTALL_TMP" "$hti"`
FAILED_EXEC_HOSTS="$FAILED_EXEC_HOSTS $hti"
fi
fi
else
$INFOTEXT -log "Host %s already installed" $hti
EXEC_HOSTS_TO_INSTALL_TMP=`RemoveHostFromList "$EXEC_HOSTS_TO_INSTALL_TMP" "$hti"`
CURRENTLY_INSTALLING_HOSTS=`RemoveHostFromList "$CURRENTLY_INSTALLING_HOSTS" "$hti"`
INSTALLED_EXEC_HOSTS="$INSTALLED_EXEC_HOSTS $hti"
fi
else
LOCALINST="true" # in this case: inst_sge -x $SMF_FLAGS -auto <conffile> -noremote was executed (mostly by isnt_sge script)
EXEC_HOSTS_TO_INSTALL_TMP="" # no other EXEC host has to be installed. The list can be cleared
break # the the loop and jump to local installation
fi
retries=0
while [ "$inst_counter" -ge "$PAR_EXECD_INST_COUNT" -o "$EXEC_HOSTS_TO_INSTALL_TMP" = "" ]; do
retries=`expr $retries + 1`
for e in $CURRENTLY_INSTALLING_HOSTS; do
#looping over the currently running installs and checks if complete or not.
#if not complete the host won't be removed from the current list
#else the host will be removed from the
if [ "$ignore_fqdn" = "true" ]; then
ExecdAlreadyInstalled `echo $e | cut -d"." -f1`
installed=$?
else
#if not ignored check, if a default domain is entered
if [ "$default_domain" != "none" ]; then
#default_domain is entered, check if given hostname is long or not
#given hostname is long the defualt domain won't be added
#given hostname is short, default_domain will be added
hasdot=`echo $e|grep '\.'`
if [ "$hasdot" = "" ]; then
e=$e.$default_domain
fi
fi
ExecdAlreadyInstalled $e
installed=$?
fi
if [ "$installed" = 1 ]; then
#if host is installed refresh the list.
inst_counter=`expr $inst_counter - 1`
retries=0
CURRENTLY_INSTALLING_HOSTS=`RemoveHostFromList "$CURRENTLY_INSTALLING_HOSTS" "$e"`
EXEC_HOSTS_TO_INSTALL_TMP=`RemoveHostFromList "$EXEC_HOSTS_TO_INSTALL_TMP" "$e"`
INSTALLED_EXEC_HOSTS="$INSTALLED_EXEC_HOSTS $e"
fi
done
sleep 3 #give the install processes time to complete
if [ "$retries" -ge "$max_retries" ]; then #if the while loop ran as often as configured in $max_retries
#we predict a failure and retries. The current hosts will marked as failed
#all lists will be updated and parallel isntall counter will be reset
inst_counter=0
FAILED_EXEC_HOSTS="$FAILED_EXEC_HOSTS $CURRENTLY_INSTALLING_HOSTS"
for e in $CURRENTLY_INSTALLING_HOSTS; do
EXEC_HOSTS_TO_INSTALL_TMP=`RemoveHostFromList "$EXEC_HOSTS_TO_INSTALL_TMP" "$e"`
done
CURRENTLY_INSTALLING_HOSTS=""
fi
if [ "$inst_counter" = 0 -o "$EXEC_HOSTS_TO_INSTALL_TMP" = "" ]; then
break
fi
done
done
EXEC_HOSTS_TO_INSTALL=$EXEC_HOSTS_TO_INSTALL_TMP #we are looping over a EXECD host list, to prevent
#listindex problems if hosts must be removed a TMP list
#will be changed, not original. After looprun the original list will be updated
if [ "$EXEC_HOSTS_TO_INSTALL" = "" ]; then
install_is_done="true" #installation is done
for e in $FAILED_EXEC_HOSTS; do
$INFOTEXT -log "The host %s failed installing an execd" $e #log hostnames, which have been marked as failed to log file
$INFOTEXT -log "Please check these hosts, it's also possible that the installation\n timed out and the installation went well, anyhow!"
done
fi
done
if [ "$LOCALINST" = "true" ]; then #do the installation on the local host
WelcomeTheUserExecHost
CheckForLocalHostResolving
ProcessSGERoot
CheckQmasterInstallation
CheckCellDirectory
. $SGE_ROOT/$SGE_CELL/common/settings.sh
SearchForExistingInstallations "execd"
CheckCSP
CheckHostNameResolving install
GetLocalExecdSpoolDir
AddLocalConfiguration_With_Qconf
AddSubmitHostsExecd
AddSGEStartUpScript $euid execd
SetupWinSvc execinst #service install during execd installation -> param: execinst
StartExecd
AddQueue
GiveHints
CheckRunningDaemon sge_execd
if [ $? = 0 ]; then
$INFOTEXT "Execd on host %s is running!\n" $h
$INFOTEXT -log "Execd on host %s is running!\n" $h
MoveLog
exit 0
else
$INFOTEXT "Execd on host %s is not started!\n" $h
$INFOTEXT -log "Execd on host %s is not started!\n" $h
MoveLog
exit 1
fi
fi
else
WelcomeTheUserExecHost
CheckForLocalHostResolving
ProcessSGERoot
CheckQmasterInstallation
CheckCellDirectory
. $SGE_ROOT/$SGE_CELL/common/settings.sh
SearchForExistingInstallations "execd"
CheckWinAdminUser
CheckCSP
CheckHostNameResolving install
GetLocalExecdSpoolDir
AddLocalConfiguration_With_Qconf
AddSGEStartUpScript $euid execd
SetupWinSvc execinst #service install during execd installation -> param: execinst
StartExecd
AddQueue
GiveHints
# This code will be executed in case inst_sge -x $SMF_FLAGS -host <remote host>
if [ -f $EXEC_HOST_LIST ]; then
for h in `cat $EXEC_HOST_LIST`; do
if [ "$QMASTER" = "install" -o "$NOREMOTE" = "false" ]; then
$INFOTEXT "Starting remote installation on host %s" $h
$INFOTEXT "This part runs in automatic mode," \
"be sure to have a valid configuration file"
if [ "$CONFIG_FILE" = "undef" ]; then
$INFOTEXT -n "Please enter the path to your autoinstall configuration file >> "
CONFIG_FILE=`Enter`
export CONFIG_FILE
else
$INFOTEXT -n "Please enter the path to your autoinstall configuration file or\n hit <RETURN> to use [%s] >> " $CONFIG_FILE
CONFIG_FILE=`Enter $CONFIG_FILE`
fi
$INFOTEXT -n "Please enter which shell you want to use for remote login (rsh/ssh) or\n hit <RETURN> to use [%s] >> " $SHELL_NAME
SHELL_NAME=`Enter $SHELL_NAME`
$INFOTEXT -wait -auto $AUTO -n "Hit <RETURN> to continue >> "
echo ". $SGE_ROOT/$SGE_CELL/common/settings.sh; cd $SGE_ROOT && ./inst_sge -x $SMF_FLAGS -auto $CONFIG_FILE -noremote" | $SHELL_NAME $h /bin/sh &
fi
done
else
if [ "$EXEC_HOST_LIST" != "undef" ]; then
for h in $EXEC_HOST_LIST; do
if [ "$QMASTER" = "install" -o "$NOREMOTE" = "false" ]; then
$INFOTEXT "Starting remote installation on host %s" $h
$INFOTEXT "This part runs in automatic mode," \
"be sure to have a valid configuration file"
if [ "$CONFIG_FILE" = "undef" ]; then
$INFOTEXT -n "Please enter the path to your autoinstall configuration file >> "
CONFIG_FILE=`Enter`
export CONFIG_FILE
else
$INFOTEXT -n "Please enter the path to your autoinstall configuration file or\n hit <RETURN> to use [%s] >> " $CONFIG_FILE
CONFIG_FILE=`Enter $CONFIG_FILE`
fi
$INFOTEXT -n "Please enter which shell you want to use for remote login (rsh/ssh) or\n hit <RETURN> to use [%s] >> " $SHELL_NAME
SHELL_NAME=`Enter $SHELL_NAME`
$INFOTEXT -wait -auto $AUTO -n "Hit <RETURN> to continue >> "
echo ". $SGE_ROOT/$SGE_CELL/common/settings.sh; cd $SGE_ROOT && ./inst_sge -x $SMF_FLAGS -auto $CONFIG -noremote" | $SHELL_NAME $h /bin/sh &
fi
done
fi
fi
fi
MoveLog
exit 0
fi
if [ "$EXECD" = "uninstall" ]; then
if [ "$AUTO" = "true" ]; then
Stdout2Log
$INFOTEXT -log "Starting execution host uninstallation!"
LogResolvedHostLists
fi
GetAdminUser
if [ "$SGE_REMOTE_FLAG" != "REMOTE_EXECD_UNINSTALL" ]; then
WelcomeUninstall
if [ "$SGE_ROOT" = "" -o "$SGE_CELL" = "" ]; then
$INFOTEXT -wait -auto $AUTO "Your SGE_ROOT or SGE_CELL variable is not set!\n" \
"Enter SGE_ROOT and SGE_CELL in the following\n" \
"screens!\n\nHit, <RETURN> to continue!"
$CLEAR
ProcessSGERoot
$INFOTEXT -n "Please enter your SGE_CELL directory or use the default [default] >> "
SGE_CELL=`Enter default`
export SGE_CELL
fi
. $SGE_ROOT/$SGE_CELL/common/settings.sh
CheckHostNameResolving uninstall
if [ "$?" = "1" ]; then
$INFOTEXT "This host is not an admin host. Uninstallation is not allowed\nfrom this host!"
$INFOTEXT -log "This host is not an admin host. Uninstallation is not allowed\nfrom this host!"
MoveLog
exit 1
fi
else
. $SGE_ROOT/$SGE_CELL/common/settings.sh
fi
FetchHostname
SetupWinSvc uninstall
MoveLog
if [ $QMASTER != "uninstall" ]; then
exit 0
fi
fi
if [ $BERKELEY = "uninstall" ]; then
GetAdminUser
if [ "$AUTO" = "true" ]; then
Stdout2Log
$INFOTEXT -log "Starting berkeley rpc uninstallation!"
fi
if [ "$DB_SPOOLING_SERVER" = "" -o "$HOST" = "$DB_SPOOLING_SERVER" -o "$NOREMOTE" = "true" ]; then
euid=`$SGE_UTILBIN/uidgid -euid`
ProcessSGERoot
GetCell
ADMINUSER=`$SGE_UTILBIN/filestat -owner . 2> /dev/null`
#SMF will stop the service on its own in RemoveRCScript
if [ "$SGE_ENABLE_SMF" != "true" ]; then
ExecuteRPCServerScript stop
fi
RemoveRcScript $HOST "bdb" $euid
DeleteSpoolingDir
else
$INFOTEXT -log "remote berkeley rpc server uninstallation on host %s" $DB_SPOOLING_SERVER
echo "cd $SGE_ROOT && ./inst_sge -udb -auto $FILE -noremote" | $SHELL_NAME $DB_SPOOLING_SERVER /bin/sh
fi
BERKELEY="undef"
fi
if [ $QMASTER = "uninstall" ]; then
GetAdminUser
if [ "$AUTO" = "true" ]; then
Stdout2Log
$INFOTEXT -log "Starting qmaster uninstallation!"
fi
if [ "$SGE_ROOT" = "" -o "$SGE_CELL" = "" ]; then
$INFOTEXT -wait -auto $AUTO "Your SGE_ROOT or SGE_CELL variable is not set!\n" \
"Please, enter SGE_ROOT and SGE_CELL in the following\n" \
"screens!\n\nHit, <ENTER> to continue!"
$CLEAR
ProcessSGERoot
$INFOTEXT -n "Please enter your SGE_CELL directory or use the default [default] >> "
SGE_CELL=`Enter default`
export SGE_CELL
fi
. $SGE_ROOT/$SGE_CELL/common/settings.sh
ServiceTagsSupport
RemoveQmaster
MoveLog
fi
if [ $SHADOW = "install" ]; then
if [ $AUTO = "false" ]; then
$INFOTEXT -u "\nShadow Master Host Setup"
$INFOTEXT -wait -n "\nMake sure, that the host, you wish to configure as a " \
"shadow host,\n has read/write permissions to the qmaster spool " \
"and SGE_ROOT/<cell>/common \ndirectory! For using a shadow master it " \
"is recommended to set up a \nBerkeley DB Spooling Server\n\n Hit <RETURN> to continue >> "
CheckWhoInstallsSGE
CheckForLocalHostResolving
ProcessSGERoot
$INFOTEXT -n "Please enter your SGE_CELL directory or use the default [default] >> "
SGE_CELL=`Enter default`
export SGE_CELL
. $SGE_ROOT/$SGE_CELL/common/settings.sh
SearchForExistingInstallations "shadowd"
CheckHostNameResolving install
if [ $HOST != "" ]; then
$SGE_UTILBIN/gethostname -all | grep $HOST > /dev/null
if [ "$?" = 0 ]; then
SHADOW_HOST=`$SGE_UTILBIN/gethostname -aname`
else
SHADOW_HOST=$HOST
fi
else
SHADOW_HOST=`$SGE_UTILBIN/gethostname -aname`
fi
#check if spooling is supported!
spooling_method=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap 2>/dev/null | grep "spooling_method" | awk '{ print $2 }'`
#if spooling_params contains no "/" then we have rpc server spooling
temp=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep spooling_params | awk '{ print $2 }' | grep "/"`
if [ $? = 0 ]; then
db_home=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap 2>/dev/null | grep "spooling_params" | awk '{ print $2 }' | cut -d";" -f1`
fstype=`$SGE_UTILBIN/fstype $db_home`
if [ $? != 0 ]; then
$INFOTEXT "\n Shadow master can not access spool directory at %s! \n" $db_home
$INFOTEXT "Check if the spool directory is mounted and has read/write permissions.\n"
exit 1
elif [ `echo $db_home | cut -d":" -f2` = "$db_home" ]; then
if [ "$spooling_method" = "berkeleydb" ]; then
if [ `echo $fstype | grep "nfs" | wc -l` -gt 0 ]; then
if [ "$fstype" != "nfs4" ]; then
$INFOTEXT "Spooling directory exported as $s is not supported!\n" $fstype
$INFOTEXT "\nPlease install the database directory on a NFSv4 fileserver or use the RPC Client/Server mechanism"
exit 1;
else
$INFOTEXT "We detected local Berkeley DB Spooling without a RPC Server. Local spooling\n is not working under " \
"mixed architectures.\n\n "
$INFOTEXT -auto $AUTO -ask "y" "n" -def "y" -n "Do you want to continue (y/n) ('n' will abort) [y] >> "
if [ $? != 0 ]; then
$INFOTEXT "Installation aborted"
exit 1;
fi
fi
fi
fi
fi
fi
#creating the local_conf now!
AddLocalConfiguration_With_Qconf
$INFOTEXT "Creating shadow_masters file for host %s\n" $SHADOW_HOST
ExecuteAsAdmin touch $SGE_ROOT/$SGE_CELL/common/shadow_masters
ALREADY_SHADOWS=`cat $SGE_ROOT/$SGE_CELL/common/shadow_masters | grep -v $SHADOW_HOST`
ExecuteAsAdmin mv $SGE_ROOT/$SGE_CELL/common/shadow_masters $SGE_ROOT/$SGE_CELL/common/shadow_masters.1
ExecuteAsAdmin touch $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin chmod a+rw $SGE_ROOT/$SGE_CELL/common/shadow_masters
ACT_QMASTER=`cat $SGE_ROOT/$SGE_CELL/common/act_qmaster`
if [ "$ACT_QMASTER" != "$SHADOW_HOST" ]; then
ExecuteAsAdmin echo "$ACT_QMASTER" >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
fi
ExecuteAsAdmin echo $SHADOW_HOST >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
for s in `echo $ALREADY_SHADOWS`; do
if [ "$ACT_QMASTER" != "$s" ]; then
ExecuteAsAdmin echo $s >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
fi
done
ExecuteAsAdmin chmod go-w $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin rm -f $SGE_ROOT/$SGE_CELL/common/shadow_masters.1
if [ $SHADOW_HOST = `$SGE_UTILBIN/gethostname -aname` ]; then
. $SGE_ROOT/$SGE_CELL/common/settings.sh
SGE_ARCH=`$SGE_ROOT/util/arch`
AddSGEStartUpScript $euid shadow
$INFOTEXT "Starting sge_shadowd on host %s\n" $SHADOW_HOST
if [ "$SGE_ENABLE_SMF" = "true" ]; then
$SVCADM enable -s "svc:/application/sge/shadowd:$SGE_CLUSTER_NAME"
else
$SGE_ROOT/bin/$SGE_ARCH/sge_shadowd &
fi
else
for shs in `cat $SGE_ROOT/$SGE_CELL/common/shadow_masters`; do
echo ". $SGE_ROOT/$SGE_CELL/common/settings.sh; SGE_ARCH=`$SGE_ROOT/util/arch`; $SGE_ROOT/bin/$SGE_ARCH/sge_shadowd &" | $SHELL_NAME $shs /bin/sh &
#TODO: install rc script
done
fi
$INFOTEXT "Shadowhost installation completed!"
else
euid=`$SGE_UTILBIN/uidgid -euid`
Stdout2Log
for SHADOW in $SHADOW_HOST; do
$INFOTEXT -log "Starting sge_shadowd on host %s" $SHADOW
ExecuteAsAdmin touch $SGE_ROOT/$SGE_CELL/common/shadow_masters
ALREADY_SHADOWS=`cat $SGE_ROOT/$SGE_CELL/common/shadow_masters | grep -v "$SHADOW"`
ExecuteAsAdmin mv $SGE_ROOT/$SGE_CELL/common/shadow_masters $SGE_ROOT/$SGE_CELL/common/shadow_masters.1
ExecuteAsAdmin touch $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin chmod a+rw $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin cat $SGE_ROOT/$SGE_CELL/common/act_qmaster >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin echo $SHADOW >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
for s in `echo $ALREADY_SHADOWS`; do
ExecuteAsAdmin echo $s >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
done
ExecuteAsAdmin chmod go-w $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin rm -f $SGE_ROOT/$SGE_CELL/common/shadow_masters.1
if [ $SHADOW = `$SGE_UTILBIN/gethostname -aname` ]; then
. $SGE_ROOT/$SGE_CELL/common/settings.sh
SGE_ARCH=`$SGE_ROOT/util/arch`
$SGE_ROOT/bin/$SGE_ARCH/sge_shadowd &
AddSGEStartUpScript $euid shadow
else
echo ". $SGE_ROOT/$SGE_CELL/common/settings.sh; SGE_ARCH=`$SGE_ROOT/util/arch`; $SGE_ROOT/bin/$SGE_ARCH/sge_shadowd &" | $SHELL_NAME $SHADOW /bin/sh &
#TODO: install rc script
fi
done
fi
MoveLog
fi
if [ $SHADOW = "uninstall" ]; then
GetAdminUser
if [ "$HOST" = "undef" -o "$HOST" = `$SGE_UTILBIN/gethostname -aname` ]; then
s_host=`$SGE_UTILBIN/gethostname -aname`
is_local="true"
else
s_host="$HOST"
is_local="false"
fi
if [ "$s_host" = "`cat $SGE_ROOT/$SGE_CELL/common/shadow_masters | grep "$s_host"`" ]; then
is_shadow="true"
m_spool=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep qmaster_spool_dir | awk '{ print $2}'`
s_pid=`cat $m_spool/shadowd_$s_host.pid`
else
is_shadow="false"
fi
if [ $AUTO = "true" ]; then
if [ "$is_local" = "true" ]; then
Stdout2Log
if [ "$is_shadow" = "false" ]; then
$INFOTEXT -log "This host is no shadow host!"
MoveLog
exit 1
fi
$INFOTEXT -log "Stopping shadowd!"
$SGE_ROOT/$SGE_CELL/common/sgemaster -shadowd stop
ExecuteAsAdmin mv $SGE_ROOT/$SGE_CELL/common/shadow_masters $SGE_ROOT/$SGE_CELL/common/shadow_masters_tmp
ExecuteAsAdmin rm -f $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin touch $SGE_ROOT/$SGE_CELL/common/shadow_masters
cat $SGE_ROOT/$SGE_CELL/common/shadow_masters_tmp | grep -v $s_host >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin rm -f $SGE_ROOT/$SGE_CELL/common/shadow_masters_tmp
ExecuteAsAdmin chown $ADMINUSER $SGE_ROOT/$SGE_CELL/common/shadow_masters
MoveLog
exit 0
else
echo "cd $SGE_ROOT; . $SGE_ROOT/$SGE_CELL/common/settings.sh; ./inst_sge -usm" | $SHELL_NAME $s_host /bin/sh &
fi
else
if [ "$is_local" = "true" ]; then
if [ "$is_shadow" = "false" ]; then
$INFOTEXT "This host is no shadow host!"
exit 1
fi
$INFOTEXT "Stopping shadowd!"
$SGE_ROOT/$SGE_CELL/common/sgemaster -shadowd stop
ExecuteAsAdmin mv $SGE_ROOT/$SGE_CELL/common/shadow_masters $SGE_ROOT/$SGE_CELL/common/shadow_masters_tmp
ExecuteAsAdmin rm -f $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin touch $SGE_ROOT/$SGE_CELL/common/shadow_masters
cat $SGE_ROOT/$SGE_CELL/common/shadow_masters_tmp | grep -v $s_host >> $SGE_ROOT/$SGE_CELL/common/shadow_masters
ExecuteAsAdmin rm -f $SGE_ROOT/$SGE_CELL/common/shadow_masters_tmp
ExecuteAsAdmin chown $ADMINUSER $SGE_ROOT/$SGE_CELL/common/shadow_masters
exit 0
else
$INFOTEXT -n "Please enter which shell you want to use for remote login (rsh/ssh) or\n hit <RETURN> to use [%s] >> " $SHELL_NAME
SHELL_NAME=`Enter $SHELL_NAME`
which $SHELL_NAME >/dev/null 2>&1
if [ "$?" = 1 ]; then
$INFOTEXT ">>%s<< is not a valid shell command, please use rsh or ssh!" $SHELL_NAME
exit 1
fi
echo "cd $SGE_ROOT; . $SGE_ROOT/$SGE_CELL/common/settings.sh; ./inst_sge -usm" | $SHELL_NAME $s_host /bin/sh &
fi
fi
fi
if [ "$SUBMIT" = "install" ]; then
if [ "$AUTO" = "true" ]; then
Stdout2Log
$INFOTEXT -log "Starting Submithost installation!"
fi
WelcomeTheUserSubmitHost
ProcessSGERoot
CheckQmasterInstallation
CheckCellDirectory
. $SGE_ROOT/$SGE_CELL/common/settings.sh
CheckHostNameResolving install
AddSubmitHosts
product_mode=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep "security_mode" | awk '{ print $2 }'`
if [ "$product_mode" = "csp" ]; then
CSP="true"
fi
CopyCA submit
MoveLog
$INFOTEXT "Submit host installation is complete!"
exit 0
fi
if [ "$COPY_CA" = "true" ]; then
if [ "$SGE_ROOT" = "" -o "$SGE_CELL" = "" ]; then
$INFOTEXT "SGE_ROOT or SGE_CELL is not set!"
exit 1
fi
if [ -f $SGE_ROOT/$SGE_CELL/common/bootstrap ]; then
GetAdminUser
else
$INFOTEXT "\nObviously there was no qmaster installation for this cell yet. The file\n\n" \
" %s\n\n" \
"does not exist. Exit." \$SGE_ROOT/$SGE_CELL/common/bootstrap
exit 1
fi
product_mode=`cat $SGE_ROOT/$SGE_CELL/common/bootstrap | grep "security_mode" | awk '{ print $2 }'`
if [ "$product_mode" = "csp" ]; then
CSP="true"
fi
CopyCA copyonly
ret=$?
if [ $ret -eq 0 ]; then
$INFOTEXT "Copying certificates is complete!"
fi
exit $ret
fi
if [ $BACKUP = "true" ]; then
BackupConfig
MoveLog
fi
if [ $RESTORE = "true" ]; then
RestoreConfig
fi
if [ $MAKE_RC = "true" ]; then
DATE=`date '+%Y-%m-%d_%H:%M:%S'`
$INFOTEXT -u "\nRC Startup Script Generation"
$INFOTEXT -wait -n "\nThis option allows you to create new startup scripts for\n" \
"qmaster/shadow daemon and the execution daemon.\n\n" \
"The new startup scripts will be saved in <sge_root>/<cell>/common.\n" \
"A copy of your old rc-scripts will be saved.\n\n" \
"Hit <RETURN> to continue >> "
ProcessSGERoot
$INFOTEXT -n "\nPlease enter your SGE_CELL directory or use the default [default] >> "
SGE_CELL=`Enter default`
SGE_CELL_VAL=$SGE_CELL
export SGE_CELL
export SGE_CELL_VAL
if [ -f $SGE_ROOT/$SGE_CELL/common/bootstrap ]; then
GetAdminUser
else
$INFOTEXT "\nObviously there was no qmaster installation for this cell yet. The file\n\n" \
" %s\n\n" \
"does not exist. Exit." \$SGE_ROOT/$SGE_CELL/common/bootstrap
exit 1
fi
if [ -f $SGE_ROOT/$SGE_CELL/common/settings.sh ]; then
. $SGE_ROOT/$SGE_CELL/common/settings.sh
else
$INFOTEXT "\nThe file\n\n" \
" %s\n\n" \
"which is required to set the environment variables does not exist. Exit." \
\$SGE_ROOT/$SGE_CELL/common/settings.sh
exit 1
fi
if [ -f $SGE_ROOT/$SGE_CELL/common/sgemaster ]; then
ExecuteAsAdmin mv $SGE_ROOT/$SGE_CELL/common/sgemaster $SGE_ROOT/$SGE_CELL/common/sgemaster_$DATE
fi
if [ -f $SGE_ROOT/$SGE_CELL/common/sgeexecd ]; then
ExecuteAsAdmin mv $SGE_ROOT/$SGE_CELL/common/sgeexecd $SGE_ROOT/$SGE_CELL/common/sgeexecd_$DATE
fi
COMMONDIR=$SGE_CELL/common
CreateSGEStartUpScripts 0 true master
CreateSGEStartUpScripts 0 true execd
$INFOTEXT "\nYour new startup scripts are created. You will find them in the\n" \
"directory:\n\n" \
" %s\n\n" \
"Your old startup scripts are saved in this directory as\n\n" \
" %s\n" \
" %s\n\n" \
\$SGE_ROOT/$COMMONDIR sgemaster_$DATE sgeexecd_$DATE
$INFOTEXT "Please now copy the new startup scripts to the system wide rc\n" \
"file location on all qmaster, shadowd and execution hosts."
fi
exit 0
|