运行Perl程序
2015-12-04 11:11
323 查看
perl环境参考http://www.confluence.oa.com/pages/viewpage.action?pageId=7077984
Crontab参考http://linuxtools-rst.readthedocs.org/zh_CN/latest/tool/crontab.html
Docker 定时器参考http://xiaorui.cc/2015/08/14/docker%E4%B8%8B%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1crontab%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95python/?utm_source=tuicool
下载R语言
wget http://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz
解压R
tar -xf R-3.2.2.tar.gz
编写Dockerfile
FROM ubuntu:14.04
RUN apt-get update -y
RUN apt-get install -y perl build-essential gfortran python-pip wget
#移入R
ADD R-3.2.2 /home/R
#安装apt-get repo
RUN apt-get -y install software-properties-common
RUN add-apt-repository ppa:gluster/glusterfs-3.5
RUN apt-get update -y
RUN apt-get install -y libpng-dev libtiff-dev
RUN apt-get install -y libreadline-dev
RUN apt-get install -y libXt-dev
RUN export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
#编译
RUN /home/R/configure --prefix $HOME
RUN make && make install
RUN pip install jieba
#安装程序依赖
RUN apt-get install -y curl
RUN curl -L http://cpanmin.us | perl - --sudo App::cpanminus
RUN apt-get install -y libmysql++-dev
RUN cpanm DBI
RUN cpanm DBD::mysql
RUN cpanm Redis
RUN cpanm JSON::XS
RUN cpanm File::Lockfile
RUN cpanm Date::Calc::XS
RUN cpanm Encode::HanConvert
RUN cpanm Unicode::UTF8
RUN cpanm Statistics::R
#将代码移入
ADD test.pl perl.pl
#增加人物计划
ADD crontab /etc/cron.d/hello-cron
RUN chmod 0644 /etc/cron.d/hello-cron
RUN touch /var/log/cron.log
CMD cron tail -f /var/log/cron.log
编写Cron脚本
*/1 * * * * root echo “Hello Perl” >> /var/log/cron.log 2>&1
*/1 * * * * root perl /perl.pl >> /var/log/cron.log 2>&1
编译
sudo docker build -t lifeix:perl .
运行
docker run -it -d --name perl lifeix:perl
进入容器
docker exec -it perl bash
查看日志
tail -f /var/log/cron.log
Crontab参考http://linuxtools-rst.readthedocs.org/zh_CN/latest/tool/crontab.html
Docker 定时器参考http://xiaorui.cc/2015/08/14/docker%E4%B8%8B%E8%AE%A1%E5%88%92%E4%BB%BB%E5%8A%A1crontab%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95python/?utm_source=tuicool
下载R语言
wget http://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz
解压R
tar -xf R-3.2.2.tar.gz
编写Dockerfile
FROM ubuntu:14.04
RUN apt-get update -y
RUN apt-get install -y perl build-essential gfortran python-pip wget
#移入R
ADD R-3.2.2 /home/R
#安装apt-get repo
RUN apt-get -y install software-properties-common
RUN add-apt-repository ppa:gluster/glusterfs-3.5
RUN apt-get update -y
RUN apt-get install -y libpng-dev libtiff-dev
RUN apt-get install -y libreadline-dev
RUN apt-get install -y libXt-dev
RUN export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
#编译
RUN /home/R/configure --prefix $HOME
RUN make && make install
RUN pip install jieba
#安装程序依赖
RUN apt-get install -y curl
RUN curl -L http://cpanmin.us | perl - --sudo App::cpanminus
RUN apt-get install -y libmysql++-dev
RUN cpanm DBI
RUN cpanm DBD::mysql
RUN cpanm Redis
RUN cpanm JSON::XS
RUN cpanm File::Lockfile
RUN cpanm Date::Calc::XS
RUN cpanm Encode::HanConvert
RUN cpanm Unicode::UTF8
RUN cpanm Statistics::R
#将代码移入
ADD test.pl perl.pl
#增加人物计划
ADD crontab /etc/cron.d/hello-cron
RUN chmod 0644 /etc/cron.d/hello-cron
RUN touch /var/log/cron.log
CMD cron tail -f /var/log/cron.log
编写Cron脚本
*/1 * * * * root echo “Hello Perl” >> /var/log/cron.log 2>&1
*/1 * * * * root perl /perl.pl >> /var/log/cron.log 2>&1
编译
sudo docker build -t lifeix:perl .
运行
docker run -it -d --name perl lifeix:perl
进入容器
docker exec -it perl bash
查看日志
tail -f /var/log/cron.log
相关文章推荐
- 关于HTTP协议状态码的问题
- Codeception API testing
- 获取APP的Launch Image,实现启动页面的过渡动画。
- 十大算法
- 关于Mysql的全文本搜索功能
- 叶金荣测试手册
- bug统计
- jQuery实现ajax调用WCF服务的方法(附带demo下载)
- position:absolute绝对定位能不能使之相对于容器右对齐?
- Hadoop伪分布式环境搭建
- 开源骇客文本编辑工具-atom之快捷键
- ulimit
- Java.lang.Class类
- Android动画解析1
- 九度OJ 1355:扑克牌顺子 (模拟)
- python 爬虫 实战 抓取妹子图中图
- stopPropagation, preventDefault 和 return false 的区别
- 触发器
- 九度OJ 1355:扑克牌顺子 (模拟)
- ulimit