Perl script works but not via CRON

前端 未结 6 1938
太阳男子
太阳男子 2020-12-11 11:56

I have a perl script (which syncs delicious to wp) which:

  1. runs via the shell but
  2. does not run via cron (and i dont get an error)

The o

6条回答
  •  [愿得一人]
    2020-12-11 12:39

    The difference between a cron job and a job run from the shell is 'environment'. The primary difference is that your profile and the like are not run for a cron job, so any environment variables you have set in your normal shell environment are not set the same in the cron environment - no extensions to PATH, no environment variables identifying where Delicious and/or WP are hosted, etc.

    Suggestion: create a cron job that simply reports the environment to a known file:

    env > /home/27632/tmp/env.27632
    

    Then see what is set in your own shell environment in comparison. Chances are, that will reveal the trouble.

    Failing that, other environmental differences are that a cron job has no terminal, and has /dev/null for input and output - so interactive stuff does not work well.

提交回复
热议问题