1

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?

4
  • What do you mean by does not work? Commented Mar 17, 2014 at 11:50
  • have you tried using absolute path in sh file? Commented Mar 17, 2014 at 11:50
  • There is no output, but ps aux says that process didn't start. Commented Mar 17, 2014 at 11:50
  • yes, I've tried with absolute path - it wasn't a fix. Commented Mar 17, 2014 at 11:53

3 Answers 3

2

(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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

2 Comments

Give 777 permission to your sh file and try again.
Please let me know about your result?
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.