Cron自动化运行perl程序不起作用?

时间:2016-04-30 11:34:55

标签: perl cron

我只是使用cron编写用于自动化目的的perl程序

我的cron是

*/30 * * * * perl /path/to/cron.pl

cron.pl

#!/usr/bin/perl
use strict;
use warnings;

`/usr/bin/perl /path/to/run.pl`;

在代码中我使用back tick运行其他perl程序。

run.pl

#!/usr/bin/perl
use strict;
use warnings;

open(FL,">text.txt") or die $!;

print FL "hi";

close FL;

每当我运行cron.pl时,它都会创建“text.txt”文件。但是cron运行程序cron.pl正在运行但是run.pl还没有运行。谁能告诉我在代码中做错了什么?

1 个答案:

答案 0 :(得分:0)

您的import akka.actor.{Actor, ActorSystem, Props} import com.typesafe.config.ConfigFactory import akka.pattern.ask import akka.util.Timeout import scala.concurrent.Await import scala.util.Success import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits.global object AskRemote extends App { val port = args(0).toInt val configStr = s""" |akka { | actor { | provider = "akka.remote.RemoteActorRefProvider" | } | remote { | enabled-transports = ["akka.remote.netty.tcp"] | netty.tcp { | hostname = "localhost" | port = $port | } | } |} """.stripMargin val config = ConfigFactory.parseString(configStr) val system = ActorSystem(s"system$port", config) if (port == 2550) { system.actorOf(Props(new MyActor), "myActor") system.awaitTermination() } else { implicit val timeout = Timeout(5.seconds) val path = s"akka.tcp://system2550@localhost:2550/user/myActor" system.actorSelection(path).resolveOne().onComplete { case Success(ref) => val fut = ref ? "hello" println(Await.result(fut, 5.seconds)) system.shutdown() } } } class MyActor extends Actor { def receive = { case s: String => println(s"got $s") sender() ! s"you sent $s" context.system.shutdown() } } 行必须包含可执行文件的完整路径!

cron