标签:scribe sum top document sof com 工具 lan help
想运行一个比较大的任务,需要很强的CPU和内存,自己老笔记本跑不动。在阿里云上租一个Ubuntu服务器,但是希望任务结束后服务器实例自动删除,要不半夜时分任务跑完了,第二天早上再回收...... 心疼 :)
做了些尝试,初步达成目的,记录如下,有些踩过的坑供借鉴。
# local shell export ESC_ID=i-xxxxxxxxx export set ESC_NAME=ali_ecs cat /root/.ssh/id_rsa.pub | ssh root@$ESC_NAME ‘mkdir -p .ssh; cat >> .ssh/authorized_keys‘
# config for osscmd
# scp /root/.osscredentials root@$ESC_NAME:/root
# config for ossfs
scp /etc/passwd-ossfs root@$ESC_NAME:/etc
# worker shell
scp /root/remoteAction.sh root@$ESC_NAME:/root echo $(hostname) echo ------------------------- ssh root@$ESC_NAME ‘chmod +x /root/remoteAction.sh; /root/remoteAction.sh‘ echo ------------------------- aliyuncli ecs StopInstance --InstanceId $ESC_ID sleep 30 aliyuncli ecs DeleteInstance --InstanceId $ESC_ID sleep 10 aliyuncli ecs DescribeInstanceAttribute --InstanceId $ESC_ID
worker shell. remoteAction.sh
apt-get update cd /root # --------------------- # install osscmd # wget -O osscmd.zip https://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/internal/oss/0.0.4/assets/sdk/OSS_Python_API_20160419.zip?spm=5176.doc32171.2.2.cRTWFj&file=OSS_Python_API_20160419.zip # apt-get -y install unzip # unzip osscmd.zip # rm *.zip # --------------------- # install ossfs wget -O ossfs.deb http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/32196/cn_zh/1481699531936/ossfs_1.80.0_ubuntu14.04_amd64.deb?spm=5176.doc32196.2.1.kxKrKX&file=ossfs_1.80.0_ubuntu14.04_amd64.deb # -y assume yes apt-get -y install gdebi-core # -n --non-interactive gdebi -n ossfs.deb mkdir /mnt/gene ossfs bob-backup /mnt/gene -ourl=http://vpc100-oss-cn-beijing.aliyuncs.com # --------------------- # run my big job cd /mnt/gene/bwa sleep 1000 #my big job :)
除了以上步骤,还有其他的自动化的方法值得尝试:
标签:scribe sum top document sof com 工具 lan help
原文地址:http://www.cnblogs.com/bob-dong/p/6245136.html