cancel
Showing results for 
Search instead for 
Did you mean: 

Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

New Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Did you resolve this issue? I'm having the same problem

Occasional Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Sadly no, I will open a new topic on that since no one will answer on that topic on this thread

 

This is the new topic
https://community.magento.com/t5/Technical-Issues/Magento-1-9-2-2-does-not-send-email-for-user-regis...

 

New Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Siteground (thanks Nikolay) just sorted a workaround for me, which seems to be working so far.

 

This is copied from the Trouble Ticket:

 

What I have done is to comment the following lines in your cron.php file and insert the other commands.

Code:

// shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1 > /dev/null 2>&1 &"));
// shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1 > /dev/null 2>&1 &"));

shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1") . "> /dev/null 2>&1 &");
shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1") . "> /dev/null 2>&1 &");

 

Cron Command in Cpanel: /usr/local/php53/bin/php-cli -f /home/YOURDOMAIN/public_html/cron.php >/dev/null 2>&1

New Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Hello,

 

My name is Ivan Stefanov and I'm one of SiteGround Senior Technical Support Engineers. 

 

We carefully followed this thread and thoroughly investigated the issue that SiteGround customers are experiencing with the reworked cron system of the latest Magento release (1.9.2.2).

 

Our official position is that there is bug in the new version of cron.php file, which should be patched. 

 

You can find more details below:

 

The differences between cron.php file of previous releases and the latest one are as follow:

 

this peace of code:

 

 

           $fileName = basename(__FILE__);
           $baseDir = dirname(__FILE__);
           shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");
           shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");


has been replaced with this:

 


  

        $fileName = escapeshellarg(basename(__FILE__));
          $cronPath = escapeshellarg(dirname(__FILE__) . '/cron.sh');
   
          shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1 > /dev/null 2>&1 &"));
          shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1 > /dev/null 2>&1 &"));

 

This does not seem to be a significant change, because the logic behind the cron system remained the same.

 

However, evaluating the parsing of PHP arguments using vardump, we noticed the following:

 

 

 string(90) "/bin/sh '/home/radiomod/public_html/cron.sh' 'cron.php' -mdefault 1 \> /dev/null 2\>\&1 \&"
/home/user/public_html/cron.sh: line 47: ps: command not found
/home/user/public_html/cron.sh: line 47: ps: command not found

I bolded the way, how Magento developers escaped the forwarding to /dev/null. In other words  “> /dev/null 2>&1 &")” shouldn't be escaped, otherwise it will be considered as an additional argument, as in the case. To simplify, currently the /dev/null redirections doesn't work as intended.

 

 

The solution that we at SiteGround suggest is the lines below to be patched as is following:

 

shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -mdefault 1") . "> /dev/null 2>&1 &");
shell_exec(escapeshellcmd("/bin/sh $cronPath $fileName -malways 1") . "> /dev/null 2>&1 &");

 

If we could be of any further assistance, do not hesitate to contact me via personal message or email at ivan.stefanov@siteground.com

 

Best regards,

Ivan Stefanov

Senior Support Engineer

@SiteGround

 

New Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Thanks for this. I'm on Siteground as well and after upgrading to 1.9.2.2, I encountered this problem. Good thing there's a solution already. Smiley Very Happy

Regular Visitor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Ivan,

 

How will the final cron command look like in cPanel?

 

/home/YOURDOMAIN/public_html/cron.php >/dev/null 2>&1

 

or 

 

/home/YOURDOMAIN/public_html/cron.php >/dev/null

 

 

?

 

 

Thank you!

New Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

This is still an issue for me using Magento 1.9.2.3, same error, and the same fix Ivan provided from Siteground Works.

 

Alex, hopefully you sorted the cron job in cpanel (Siteground's support would have sorted this quickly for you on a support ticket) but my working cron command is:

 

php /home/YOURCPANELNAME/public_html/cron.php > /dev/null

or if your magento is in a sub-folder:

php /home/YOURCPANELNAME/public_html/SUBFOLDER/cron.php > /dev/null

Smiley Happy

 

 

 

 

Occasional Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

this did not work for me in Magento ver. 1.9.2.4 any ideas

New Contributor

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

@riandrio2309

 

This actually still works with Magento 1.9.2.4.

 

I have a zipped cron.sh and cron.php for your convenience, just replace your 1.9.2.4 cron.sh and cron.php with this:

http://jehzlau.net/cronfix-magento.1.9.2.4.zip

Senior Member

Re: Siteground hosting - after upgrade to 1.9.2.2 cron.sh: line 46: ps: command not found

Hi jehzlau, the link is death...