How to expand out a cron script to run manually

时间:2021-01-15 01:05:48

This is my cron script (a portion of):

这是我的cron脚本(部分):

CUSER=tim
APPDIR=/var/www/testing
APPVENV=/var/www/testing/ven
cat > $APPDIR/cronfile << EOF
PWD=$APPDIR/$CUSER
PATH=$APPVENV/bin:\$PATH
0 2 * * * testapp search newsite
EOF
crontab $APPDIR/cronfile

It seems to work but I'm really confused about how I would try to run this manually. What does this expand to if I wanted to run it from a command from shell?

它似乎工作,但我真的很困惑我将如何尝试手动运行它。如果我想从shell命令运行它,它会扩展到什么?

I tried something like this but it didn't work :(

我试过这样的东西,但它不起作用:(

cd /var/www/testing/ven 
testapp search newsite

1 个解决方案

#1


0  

This looks wrong:

这看起来不对:

PATH=$APPVENV/bin:\$PATH

There should not be a backslash in there.

那里不应该有反斜杠。

Manually would be:

手动将是:

cd /var/www/testing/tim
PATH=/var/www/testing/ven/bin:$PATH 
testapp search newsite

#1


0  

This looks wrong:

这看起来不对:

PATH=$APPVENV/bin:\$PATH

There should not be a backslash in there.

那里不应该有反斜杠。

Manually would be:

手动将是:

cd /var/www/testing/tim
PATH=/var/www/testing/ven/bin:$PATH 
testapp search newsite