crontab定时执行c二进制文件问题

当c源文件编译成功后, 好比AUTOBATCH
bash

直接输入AUTOBATCH就能够执行了,可是写入crontab定时任务中时,就执行不了了,由于crontab是不识别环境变量的,所以app

须要把环境变量写入一个sh脚本文件中,而后把AUTOBATCH执行条件也写入该sh中spa

我写的是AUTOBATCH.shcrontab

内容以下:编译

#! /bin/bash变量

#############################定时任务

.  ~/.bash_profilefile

.   /etc/profile脚本

#############################tab


cd /home/appuser/project/bin

AUTOBATCH

而后crontab定时 :

38 11 * * * /home/appuser/project/bin/AUTOBATCH.sh

38 11 * * * echo 'autobatch end up'

就能够了,主要是 环境变量的问题与路径的问题!

相关文章
相关标签/搜索