Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Sample User Data Scripts

Example

 Simple user_data.sh
#!/bin/bash

set -x

#typical aws-style hostname
NEW_HOSTNAME=$( echo ip-$( hostname -I |sed 's/\./-/g' |sed 's/ //g' ) )
hostname ${NEW_HOSTNAME}

##temporarily change the root password
#echo root:AAAAAA |chpasswd

##delete line 3 of /etc/hosts
#sed -i.orig '3d' /etc/hosts

#add an /etc/hosts self-identifying entry
echo >> /etc/hosts
echo -e "$( hostname -I )\t\t\t${NEW_HOSTNAME}" >> /etc/hosts

##aws-resource-connector based AMI has a local /opt/lsf/conf asset
## and needs configuration file updated to faciliate startup under
## the XIO Provider in Resource Connector:
## change resource designation
sed -i 's/awshost/xiohost/g' /opt/lsf/conf/lsf.conf
. /opt/lsf/conf/profile.lsf
lsadmin limstartup
lsadmin resstartup
badmin hstartup

 

  • No labels