Changes

From Genome Analysis Wiki
Jump to navigationJump to search
Line 140: Line 140:  
<code>
 
<code>
 
ubuntu@ip-10-254-60-210:~$ sudo more /etc/rc.local
 
ubuntu@ip-10-254-60-210:~$ sudo more /etc/rc.local
#!/bin/sh  
+
#!/bin/sh  
#
+
#
# rc.local
+
# rc.local
#
+
#
# This script is executed at the end of each multiuser runlevel.
+
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
+
# Make sure that the script will "exit 0" on success or any other
# value on error.
+
# value on error.
#
+
#
# In order to enable or disable this script just change the execution
+
# In order to enable or disable this script just change the execution
# bits.
+
# bits.
#
+
#
# By default this script does nothing.
+
# By default this script does nothing.
USER=ubuntu
+
USER=ubuntu
THOUSANDG=/mnt/1000g
+
THOUSANDG=/mnt/1000g
FILES3=/etc/passwd-s3fs    # Where s3fs access info will live
+
FILES3=/etc/passwd-s3fs    # Where s3fs access info will live
S3ERR=/tmp/s3fs.err
+
S3ERR=/tmp/s3fs.err
#  These are needed for s3fs access
+
#  These are needed for s3fs access
AWSACCESSKEYID=AKIAxxxxxxZ3YCZF2Q
+
AWSACCESSKEYID=AKIAxxxxxxZ3YCZF2Q
AWSSECRETACCESSKEY=ft1eJa3WxxxxxxxNlbA08x/G8iMqkMIkJjFCIGf
+
AWSSECRETACCESSKEY=ft1eJa3WxxxxxxxNlbA08x/G8iMqkMIkJjFCIGf
 
+
 
+
#    Check that we have swap set up
+
#    Check that we have swap set up
a=`swapon -s | grep -v File`
+
a=`swapon -s | grep -v File`
if [ "$a" = "" ]; then
+
if [ "$a" = "" ]; then
  echo "#######################################################"
+
  echo "#######################################################"
  echo "#  You have no SWAP file set up"
+
  echo "#  You have no SWAP file set up"
  echo ""
+
  echo ""
  echo "#  swap=/mnt/swapfile"
+
  echo "#  swap=/mnt/swapfile"
  echo "#  sudo dd if=/dev/zero of=$swap bs=1073741824 count=20"
+
  echo "#  sudo dd if=/dev/zero of=$swap bs=1073741824 count=20"
  echo "#  sudo chown root:root $swap"
+
  echo "#  sudo chown root:root $swap"
  echo "#  sudo mkswap $swap"
+
  echo "#  sudo mkswap $swap"
  echo "#  sudo chmod 0600 $swap"
+
  echo "#  sudo chmod 0600 $swap"
  echo "#  sudo swapon $swap"
+
  echo "#  sudo swapon $swap"
  echo ""
+
  echo ""
  echo "#  If need be, add to /etc/fstab"
+
  echo "#  If need be, add to /etc/fstab"
  echo "#  echo "$swap  none swap sw  0  0" >> /etc/fstab"
+
  echo "#  echo "$swap  none swap sw  0  0" >> /etc/fstab"
  echo "#######################################################"
+
  echo "#######################################################"
fi
+
fi
 
+
#    Set up for GotCloud
+
#    Set up for GotCloud
gc=/gotcloud.mnt
+
gc=/gotcloud.mnt
if [ ! -r $gc/release_version.txt ]; then
+
if [ ! -r $gc/release_version.txt ]; then
  mkdir -p $gc
+
  mkdir -p $gc
  mount /dev/xvdg $gc
+
  mount /dev/xvdg $gc
  if [ -d $gc/gotcloud.ref ]; then
+
  if [ -d $gc/gotcloud.ref ]; then
    echo "#######################################################"
+
    echo "#######################################################"
    echo "#  GotCloud is set up on $gc"
+
    echo "#  GotCloud is set up on $gc"
    echo "#######################################################"
+
    echo "#######################################################"
  fi
+
  fi
fi
+
fi
 
+
#    Set up access to S3 storage as normal filesystem  
+
#    Set up access to S3 storage as normal filesystem  
echo "${AWSACCESSKEYID}:$AWSSECRETACCESSKEY" > $FILES3
+
echo "${AWSACCESSKEYID}:$AWSSECRETACCESSKEY" > $FILES3
chown root.root $FILES3
+
chown root.root $FILES3
chmod 640 $FILES3
+
chmod 640 $FILES3
 
+
usermod -aG fuse $USER
+
usermod -aG fuse $USER
 
+
#    Setup 1000genomes
+
#    Setup 1000genomes
mkdir -p $THOUSANDG
+
mkdir -p $THOUSANDG
if [ ! -r $THOUSANDG/release ]; then
+
if [ ! -r $THOUSANDG/release ]; then
  chown $USER.$USER $THOUSANDG
+
  chown $USER.$USER $THOUSANDG
  /usr/local/bin/s3fs -o allow_other 1000genomes $THOUSANDG > $S3ERR 2>&1
+
  /usr/local/bin/s3fs -o allow_other 1000genomes $THOUSANDG > $S3ERR 2>&1
  if [ ! -r $THOUSANDG/alignment.index ]; then
+
  if [ ! -r $THOUSANDG/alignment.index ]; then
    echo "#######################################################"
+
    echo "#######################################################"
    echo "#  1000genomes is not set up on $THOUSANDG"
+
    echo "#  1000genomes is not set up on $THOUSANDG"
    echo "#  See S3FS errors in $S3ERR"
+
    echo "#  See S3FS errors in $S3ERR"
    echo "#######################################################"
+
    echo "#######################################################"
  fi
+
  fi
  df -h
+
  df -h
fi
+
fi
exit 0
+
exit 0
 
   
</code>
 
</code>
  
283

edits

Navigation menu