2

I want to execute à Symfony3 command on a OVH mutualised server but i still get an error.

i created a sh script "verifyCampaign.sh" and put in www/cron :

#!/bin/bash
cd /home/siteName/www/
/usr/local/php7.0/bin/php /home/siteName/www/bin/console app:verify-campaign

I know OVH find my script because i have this information in the cron log :

[2017-06-17 04:38:01] ## OVH ## START - 2017-06-17 04:38:01.601227 executing: /homez.76/siteNamesrd/./www/cron/verifyCampaign.sh 
[2017-06-17 04:38:01] ## OVH ## ERROR command '/homez.76/siteNamesrd/./www/cron/verifyCampaign.sh' must be executable
[2017-06-17 04:38:01] 
[2017-06-17 04:38:01] ## OVH ## END - 2017-06-17 02:38:01.725728 exitcode: 255

But why it is telling me this error ? When i try my command in the console online it's working well

EDIT

In chmod 777 i have a new error :

[2017-06-20 14:53:01] ## OVH ## START - 2017-06-20 14:53:01.977160 executing: /homez.76/siteName/./www/cron/verifyCampaign.sh 
[2017-06-20 14:53:01] /homez.76/siteName/./www/cron/verifyCampaign.sh: line 2: cd: /home/siteName/www/: No such file or directory
[2017-06-20 14:53:01] Could not open input file: /home/siteName/www/bin/console
[2017-06-20 14:53:01] 
[2017-06-20 14:53:01] ## OVH ## END - 2017-06-20 12:53:02.165789 exitcode: 1

I gonna try different path now. So it's seems it's the right on the script that was the problem

EDIT - IMPROVE ANSWER

As said in the accepted answer, the problem was the access right on the script file .

For the other problem, in ovh the right path for access to your folder is :

/homez.id/SiteUserName/www/

In my case id = 76

So if you wangt to execute a Symfony3 command you have to do like that :

#!/bin/bash
cd /homez.id/siteUserName/www/
/usr/local/php7.0/bin/php /homez.id/siteUserName/www/bin/console your:commandName

In my case, your:commandName = app:verify-campaign

LedZelkin
  • 586
  • 1
  • 10
  • 24
  • `chmod +x /homez.76/siteNamesrd/./www/cron/verifyCampaign.sh` – malcolm Jun 17 '17 at 20:54
  • Do i have to put this line in the sh file ? or just execute it from fileZilla ? – LedZelkin Jun 17 '17 at 21:08
  • In command line, its just a command, but watch the results for any error. – malcolm Jun 17 '17 at 21:19
  • For me the only to execute a command is by fillezilla because it's not a dedicated server. And whe i try this one i got `550 Could not change perms on /homez.76/siteNamesrd/./www/cron/verifyCampaign.sh: No such file or directory` – LedZelkin Jun 17 '17 at 21:26
  • So find your file `verifyCampaign.sh` in filezilla and change permission to execute the file (by right click). – malcolm Jun 17 '17 at 21:27
  • It worked with @gview's answer `chmod +x /www/cron/verifyCampaign.sh` . But still get the same error in OVH logs. Maybe it's not the right way to start a Symfony Command ? – LedZelkin Jun 17 '17 at 21:28

1 Answers1

1

It's telling you that the script does not have the execute bit set allowing the cron user who is running it to execute it. You would need to use chmod to do that. This might be overkill but:

chmod ugo+x verifyCampaign.sh

Will certainly take care of it.

gview
  • 14,876
  • 3
  • 46
  • 51
  • Ok i'm gonna try like that. The script will be executed in 40 minutes and i will leave a feddback after – LedZelkin Jun 17 '17 at 19:04
  • Same error exactly? What are the permissions for the verifyCampaign.sh script? Also who is the owner of the script? – gview Jun 18 '17 at 19:18
  • Yes exactly the same error. I'm trying in permission 777. How can i determine the owner of the script ? – LedZelkin Jun 20 '17 at 12:29
  • Ok now it's work in 777 but i have a new error, check my edit – LedZelkin Jun 20 '17 at 13:06
  • The error is telling you that when it tries to cd /home/siteName/www/, it can not find that directory. Since it can't find that directory, it can't then run the console script. – gview Jun 20 '17 at 18:19
  • Yeah i know, it's why i'm trying multiple path now :p. But it's not well documented in OVH.... – LedZelkin Jun 20 '17 at 18:20