zoukankan      html  css  js  c++  java
  • Linux下crontab内环境变量与Shell环境变量的关系【转】

    crontab,总是不会缺省的从用户profile文件中读取环境变量参数

    经常导致在手工执行某个脚本时是成功的,但是到crontab中试图执行时就会报错。

    解决办法如下:

    方法一:在shell文件中获取环境变量值路径写成绝对路径,不用环境变量的路径值。例如获取CPU的使用情况,通过/proc/cpuinfo来获取

    方法二:在shell脚本缺省的#!/bin/bash 开头换行后执行

               source /etc/profile

               source $HOME/.bash_profile

    这样,crontab在执行脚本的时候,就能够读取到用户的环境变量参数。

    【转自】http://www.360doc.com/content/14/0418/13/3300331_370028474.shtml

  • 相关阅读:
    position中的四种属性
    CSS中link和@import的区别
    隐藏对应元素的办法
    word20161217
    word20161216
    word20161215
    word20161214
    word20161213
    word201612012
    word20161211
  • 原文地址:https://www.cnblogs.com/zhzhang/p/5028549.html
Copyright © 2011-2022 走看看