Import user's Environment path into Linux cron task

How to use "cron" to create scheduled task

Minimum time cycle: 1 minute

Use crontab -e edit scheduled task

25     10      *   *    * (/bin/bash /your/scripts/dir/test.sh)

If user Environment Variable need to be used, you need add . /etc/profile and . ~/.bash_profile in your scripts:
test.sh

#!/bin/bash
. /etc/profile
. ~/.bash_profile

posted on 2016-07-28 21:01  CoderFei  阅读(133)  评论(0)    收藏  举报

导航