CRON on synology DS214se NAS

时间:2015-08-30 11:26:19

标签: php cron synology

我在将CRON规则添加到synology DS214se时遇到问题。

  1. 我在/ etc / crontab

    中添加了一行

    <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="angular/lib/angular.min.js"></script> <script type="text/javascript" src="js/controller/studentinfo.js"></script> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div id="container"> <div id="header"> <h1> <span class="black-text">School Management Site</span> </h1> </div><!--header end--> <div id="topmenu"> <ul> <li> <a href="school_home_page.jsp">HOME</a> </li> <li> <a href="student_Info_page.html">STUDENTS</a> </li> <li> <a href="class_info_.jsp">CLASS INFORMARION</a> </li> <li> <a href="login.jsp">LOGOUT</a> </li> </ul> </div><!--topmenu end--> <div id="content"> <div class="jumbotron"> <div ng-controller="studentInfoController" ng-init="getStudentsInfo()"> <form name="studentform" ng-submit="submitStudentForm(studentform.$valid)" novalidate> <div class="form-group"> <h3>Student Form:</h3> <h4 style="color: red;">{{errorModel.errorMessage}}</h4> <label for="rollno" style="color: blue;">StudentRollNo:</label> <div class="col-sm-12"> <div class="col-sm-3"> <input type="text" class="form-control" id="rollno" name="studentRollNo" ng-model="student.studentRollNo" required placeholder="RollNo"> </div> <div class="col-sm-9"> <span style="color: red" ng-show="studentform.studentRollNo.$error.required && submitted"> StudentRollNo is required.</span> </div> </div> </div> <div class="form-group"> <label for="name" style="color: blue;">StudentName:</label> <div class="col-sm-12"> <div class="col-sm-3"> <input type="text" class="form-control" id="studentName" name="studentName" ng-model="student.studentName" required placeholder="StudentName"> </div> <div class="col-sm-9"> <span style="color: red" ng-show="studentform.studentName.$error.required && submitted"> StudentName is required.</span> </div> </div> </div> <div class="form-group"> <label for="name" style="color: blue;">Address:</label> <div class="form-group"> <div class="col-sm-12"> <div class="col-sm-3"> <input type="text" class="form-control" id="village" name="village" ng-model="student.village" placeholder="Village" > </div> </div> </div> <br/> <br/> <div class="col-sm-12"> <div class="col-sm-3"> <input type="text" class="form-control" id="districtName" name="districtName" ng-model="student.districtName" placeholder="DistrictName" > </div> <div class="col-sm-9"> <span style="color: red" ng-show="studentform.districtName.$error.required && submitted"> DistrictName is required. </span> </div> </div> </div> <br/> <br/> <div class="form-group"> <div class="col-sm-12"> <div class="col-sm-3"> <input type="text" class="form-control" id="state" name="state" ng-model="student.state" required placeholder="State"> </div> <div class="col-sm-9"> <span style="color: red" ng-show="studentform.state.$error.required && submitted"> StateName is required.</span> </div> </div> </div> <br/> <br/> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-primary">Submit</button> </div> </div> </form> Total Number of Student:<label style="color: black">{{studentsData.length}}</label> <table id="stuId" border="1" style="color: blue;"> <tr> <th>StudentRollNo</th> <th>StudentName</th> <th>DELETE</th> <td></td> </tr> <tr ng-repeat="student in studentsData" style="color: black;"> <td> {{student.studentRollNo}} </td> <td> {{student.studentName}} </td> <td> <input type="button" name="info" value="DeleteStudent" ng-click = "deleteStudent({{student.addresId}})"> </td> </tr> </table> </div> </div> </div><!--content endss--> </div><!--container end--> </body>

  2. 保存crontab并使用

    重新启动它

    * * * * * root /volume1/web/gym/bin/cron/cronTabTest.php

  3. 重启NAS框。

  4. 重启后命令行在/ etc / crontab中但不起作用。
  5. 我做错了什么?请帮我。

    这是cronTabTest.php:

    /usr/syno/sbin/synoservicectl --restart crond

1 个答案:

答案 0 :(得分:1)

首先,您的cron行在开头缺少php。改变行

* * * * * root /volume1/web/gym/bin/cron/cronTabTest.php

* * * * * root /usr/bin/php /volume1/web/gym/bin/cron/cronTabTest.php

其次,在处理cli时,您需要确保从服务器的根目录提供所有正在调用的文件的完整路径。例如:

$file = '/volume1/web/gym/bin/cron/test.txt';
file_put_contents($file, date('Y-m-d H:i:s').' ',FILE_APPEND);
echo 'cron';