#!/bin/bash
# 30 * * * * *//data/wwwroot/www.test.com/sendbaiduurl.sh each hour of 0 and 30 execute this script
# crontab configuration
Export ORI_WORK_DIR=$(PWD)
Export CODE_HOME=$(CD ` dirname $0 `; The PWD)
CD ${CODE_HOME}
CURRENT_TIME=$(date "+ % Y - m - H: % d % % % m: % S")
# the PHP interpreter need to specify the absolute path
PHP_COMMAND=`/usr/local/PHP/bin/PHP think SendBaiduUrl `
RESULT=$(echo ${PHP_COMMAND})
Echo "[]" ${CURRENT_TIME} "" ${RESULT} & gt;> Sendurl. Log
The exit 0
I wrote a regular script, the plan is every 30 minutes in the specified directory to perform a PHP think SendBaiduUrl this name, then it stitching on the echo time redirect to sendurl. The log log, I check found that the script will not run regular, don't know what the reason, the following screenshots, command running normally, but stitching errors, which the great spirit guide how
CodePudding user response:
Because don't know whether I think in certain period of time the returned result is empty,In addition, suggested that the 9, 10 lines to:
PHP_COMMAND="/usr/local/PHP/bin/PHP think SendBaiduUrl"
RESULT=$($PHP_COMMAND)
Try, seemingly don't need to echo
But for the most part or estimated or because of the time...