运行Perl程序

2016-07-18 11:01:17来源:oschina作者:曾光伟人点击

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语言

wgethttp://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz

解压R

tar-xfR-3.2.2.tar.gz

编写Dockerfile

FROMubuntu:14.04

RUNapt-getupdate -y

RUNapt-getinstall-yperlbuild-essentialgfortranpython-pipwget

#移入R

ADDR-3.2.2/home/R

#安装apt-get repo

RUNapt-get-yinstallsoftware-properties-common

RUNadd-apt-repositoryppa:gluster/glusterfs-3.5

RUNapt-getupdate -y

RUNapt-getinstall-ylibpng-dev libtiff-dev

RUNapt-getinstall -ylibreadline-dev

RUNapt-getinstall-ylibXt-dev

RUNexportPKG_CONFIG_PATH=/usr/lib/pkgconfig/

#编译

RUN/home/R/configure--prefix$HOME

RUNmake&&makeinstall

RUNpipinstalljieba

#安装程序依赖

RUNapt-get install -y curl

RUNcurl-Lhttp://cpanmin.us|perl---sudoApp::cpanminus

RUNapt-getinstall -y libmysql++-dev

RUNcpanmDBI

RUNcpanmDBD::mysql

RUNcpanmRedis

RUNcpanmJSON::XS

RUNcpanmFile::Lockfile

RUNcpanmDate::Calc::XS

RUNcpanmEncode::HanConvert

RUNcpanmUnicode::UTF8

RUNcpanmStatistics::R

#将代码移入

ADDtest.plperl.pl

#增加人物计划

ADDcrontab/etc/cron.d/hello-cron

RUNchmod0644/etc/cron.d/hello-cron

RUNtouch/var/log/cron.log

CMDcrontail-f/var/log/cron.log

编写Cron脚本

*/1 ****rootecho“HelloPerl”>>/var/log/cron.log2>&1

*/1****rootperl/perl.pl>>/var/log/cron.log2>&1

编译

sudodockerbuild-tlifeix:perl .

运行

dockerrun-it-d--nameperl lifeix:perl

进入容器

dockerexec-itperl bash

查看日志

tail-f/var/log/cron.log


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台