---
title: "[crontab] 在bash中加载cron环境以进行debug"
author: "iandaicsu"
date: "2013-09-18T16:59:44Z"
tags: []
categories: ["移动开发"]
slug: "crontab-bash-cron-debug"
draft: false
lastmod: "2013-09-18T16:59:44Z"
id: 1943903
url: "https://iandaicsu.iteye.com/blog/1943903"
---

自动加载crontab的运行env，并在bash中加载crontab的环境，对script进行测试

http://stackoverflow.com/questions/2135478/how-to-simulate-the-environment-cron-executes-a-script-with

Add this to your cron:

30 08 * * * env &gt; ~/cronenv

After it runs, do this:

env - \`cat ~/cronenv\` /bin/sh

 

在cron中加载rvm环境

http://rvm.io/integration/cron

 

查看cron运行的情况

sudo tail /var/log/cron