Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

Sample User Data Scripts

Example

Expand
titleSimple user_data.sh
Code Block
#!/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

...