Limon Monte
Limon Monte

Reputation: 54409

PHPUnit + crontab: only header when output result to file

I want to run PHPUnit on prod server every hour and write result to file. Here's the crontab line:

0 * * * * cd /path/to/project && /usr/local/bin/phpunit --exclude-group acceptance > phpunit.result

When I run that command manually phpunit.result contains expected result, but when using crontab there's only the PHPUnit header in phpunit.result:

PHPUnit 4.6.4 by Sebastian Bergmann and contributors.

Configuration read from /path/to/project/phpunit.xml

How can I achieve correct output PHPUnit result to file using crontab?

Upvotes: 0

Views: 670

Answers (2)

Aleksander Wons
Aleksander Wons

Reputation: 3967

You can just use in with one command using full paths. Something like:

php /usr/local/bin/phpunit -c /path/to/project/phpunit.xml > /tmp/phpunit.log 2>&1

It will redirect the std error to the file, too. Then you will see what is actually happening when you run those tests.

Upvotes: 2

Jebastin Imanuel
Jebastin Imanuel

Reputation: 1

Use like this commends in Linux system...

  1. sudo crontab -e =>(create cron tab)

    -> learn command = */2 * * * * wget (i am created crontab for every 2 mins..)

    -> create command for crontab = */2 * * * * wget -q http://localhost/trigger_yoururl

    -> ^o run that..

    -> ^x exit that..

  2. sudo crontab -l =>(list view for cron tab)

  3. sudo crontab -r =>(remove cron tab)

Upvotes: -1

Related Questions