Roman  Kliuchko
Roman Kliuchko

Reputation: 499

Running Symfony2 command in background

Let's say I have Symfony2 Command example:command. It works fine, when I type in terminal:

php app/console example:command &

But if I trying to do it with sh file, like:

#!/bin/bash
php app/console example:command &

it does not work. What may cause the problem?

Upvotes: 1

Views: 1077

Answers (3)

Gara
Gara

Reputation: 626

In .sh file, Please access your directory then run that command.
Ex: please use this two steps in your .sh file

cd /var/www/project 

$ php app/console example:command

Upvotes: 0

Javad
Javad

Reputation: 4397

(I assume your Symfony path is /var/www/Symfony/ ) In sh file try this

/usr/bin/php /var/www/Symfony/app/console example:command

If you want to run it in crontab as well, you need to redirect the the Symfony folder by cd then call your sh file to be executed.

Upvotes: 2

Ehsan
Ehsan

Reputation: 396

You should copy your sh file at symfony root directory and then run this sh file.

Upvotes: 1

Related Questions