removed sudo and add exit on error

This commit is contained in:
Xavier Pillons 2020-05-12 11:28:04 +02:00
Родитель 0d9000922a
Коммит 776946a001
2 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -1,17 +1,17 @@
#!/bin/bash
set -e
# arg: $1 = pbs_server
pbs_server=$1
if [ "$(rpm -qa pbspro-execution)" = "" ];then
sudo yum install -y pbspro-execution-19.1.1-0.x86_64.rpm
yum install -y pbspro-execution-19.1.1-0.x86_64.rpm
sudo sed -i "s/CHANGE_THIS_TO_PBS_PRO_SERVER_HOSTNAME/${pbs_server}/g" /etc/pbs.conf
sudo sed -i "s/CHANGE_THIS_TO_PBS_PRO_SERVER_HOSTNAME/${pbs_server}/g" /var/spool/pbs/mom_priv/config
sudo sed -i "s/^if /#if /g" /opt/pbs/lib/init.d/limits.pbs_mom
sudo sed -i "s/^fi/#fi /g" /opt/pbs/lib/init.d/limits.pbs_mom
sudo systemctl enable pbs
sudo systemctl start pbs
sed -i "s/CHANGE_THIS_TO_PBS_PRO_SERVER_HOSTNAME/${pbs_server}/g" /etc/pbs.conf
sed -i "s/CHANGE_THIS_TO_PBS_PRO_SERVER_HOSTNAME/${pbs_server}/g" /var/spool/pbs/mom_priv/config
sed -i "s/^if /#if /g" /opt/pbs/lib/init.d/limits.pbs_mom
sed -i "s/^fi/#fi /g" /opt/pbs/lib/init.d/limits.pbs_mom
systemctl enable pbs
systemctl start pbs
# Retrieve the VMSS name to be used as the pool name for multiple VMSS support
poolName=$(curl -s -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=2018-10-01" | jq -r '.compute.vmScaleSetName')

Просмотреть файл

@ -1,19 +1,19 @@
#!/bin/bash
set -e
admin_user=$(whoami)
if [ "$(rpm -qa pbspro-server)" = "" ];then
sudo yum install -y pbspro-server-19.1.1-0.x86_64.rpm
sudo systemctl enable pbs
sudo systemctl start pbs
sudo /opt/pbs/bin/qmgr -c "s s managers += ${admin_user}@*"
sudo /opt/pbs/bin/qmgr -c 's s flatuid=t'
sudo /opt/pbs/bin/qmgr -c 's s job_history_enable=t'
sudo /opt/pbs/bin/qmgr -c 'c r pool_name type=string,flag=h'
yum install -y pbspro-server-19.1.1-0.x86_64.rpm
systemctl enable pbs
systemctl start pbs
/opt/pbs/bin/qmgr -c "s s managers += ${admin_user}@*"
/opt/pbs/bin/qmgr -c 's s flatuid=t'
/opt/pbs/bin/qmgr -c 's s job_history_enable=t'
/opt/pbs/bin/qmgr -c 'c r pool_name type=string,flag=h'
# Update the sched_config file to schedule jobs that request pool_name
sudo sed -i "s/^resources: \"ncpus,/resources: \"ncpus, pool_name,/g" /var/spool/pbs/sched_priv/sched_config
sudo systemctl restart pbs
sed -i "s/^resources: \"ncpus,/resources: \"ncpus, pool_name,/g" /var/spool/pbs/sched_priv/sched_config
systemctl restart pbs
else
echo "PBSPro already installed"
fi