Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Cron job problem ...

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
6 posts • Page 1 of 1
247x
Posts: 3
Joined: Wed Jan 14, 2015 7:56 pm

Cron job problem ...
  • Quote

Post by 247x » Wed Jan 14, 2015 8:07 pm

Hi,

Maybe someone of you could help me with this issue. I do not know much about server administration but I managed to install VestaCP to my VPS server (Ubuntu 14.04) by myself. My web shop needs to do cron job every minute but when I created cron job in VestaCP it run this cron job every 16th minute twice.

cron job I created is:
/usr/bin/wget -O /dev/null -q http://mydomain.com/cron.php
-> so, my crontabs/admin file (/var/spool/cron/crontabs/admin) looks like this:
MAILTO=[email protected]
15 02 * * * sudo /usr/local/vesta/bin/v-update-sys-queue disk
10 00 * * * sudo /usr/local/vesta/bin/v-update-sys-queue traffic
30 03 * * * sudo /usr/local/vesta/bin/v-update-sys-queue webstats
*/5 * * * * sudo /usr/local/vesta/bin/v-update-sys-queue backup
10 05 * * * sudo /usr/local/vesta/bin/v-backup-users
20 00 * * * sudo /usr/local/vesta/bin/v-update-user-stats
*/5 * * * * sudo /usr/local/vesta/bin/v-update-sys-rrd
* * * * * /usr/bin/wget -O /dev/null -q http://mydomain.com/cron.php

this cron.php file in encrypted and I had to install ionCube Loader to my server

Access Log looks like this
XXX.XXX.XXX.XXX - - [14/Jan/2015:19:50:01 +0100] "GET /cron.php HTTP/1.0" 301 521 "-" "Wget/1.15 (linux-gnu)"
XXX.XXX.XXX.XXX - - [14/Jan/2015:19:50:01 +0100] "GET /cron.php HTTP/1.0" 200 263 "-" "Wget/1.15 (linux-gnu)"
XXX.XXX.XXX.XXX - - [14/Jan/2015:20:06:01 +0100] "GET /cron.php HTTP/1.0" 301 521 "-" "Wget/1.15 (linux-gnu)"
XXX.XXX.XXX.XXX - - [14/Jan/2015:20:06:01 +0100] "GET /cron.php HTTP/1.0" 200 263 "-" "Wget/1.15 (linux-gnu)"
XXX.XXX.XXX.XXX - - [14/Jan/2015:20:22:01 +0100] "GET /cron.php HTTP/1.0" 301 521 "-" "Wget/1.15 (linux-gnu)"
XXX.XXX.XXX.XXX - - [14/Jan/2015:20:22:01 +0100] "GET /cron.php HTTP/1.0" 200 263 "-" "Wget/1.15 (linux-gnu)"
...

Otherwise all seems to be good and shop runs ok.

Thanks,
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Cron job problem ...
  • Quote

Post by skurudo » Wed Jan 14, 2015 8:32 pm

Hello,
witch ssh access your user has? Can he use wget without sudo? Please add sudo and check again.

or you can another way, why can't we get cron via php? Like this:
/usr/bin/php /home/user/web/userdomain/public_html/cron.php
Top

247x
Posts: 3
Joined: Wed Jan 14, 2015 7:56 pm

Re: Cron job problem ...
  • Quote

Post by 247x » Wed Jan 14, 2015 8:54 pm

What does that "which ssh access your user has?" means?

I tried earlier today sudo -> sudo /usr/bin/wget -O /dev/null -q http://mydomain.com/cron.php
-> I got email notification every minute:
sudo: no tty present and no askpass program specified

I also tried earlier -> /usr/bin/php -q /home/admin/web/userdomain/public_html/cron.php
-> I got email notification every minute:
Site error: the file <b>/home/admin/web/userdomain/public_html/cron.php</b> requires the ionCube PHP Loader ioncube_loader_lin_5.5.so to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.

When I contact to this application support they said that "We need to set the cron job using wget command and not by /usr/bin/php" ... and asked to contact hosting support.

I can also run manually this cron.php whenever I want by visiting web page mydomain.com/cron.php and it works.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Cron job problem ...
  • Quote

Post by skurudo » Thu Jan 15, 2015 5:31 am

247x wrote:What does that "which ssh access your user has?" means?
Image

If it's "no login", then try change this to bash
247x wrote:I tried earlier today sudo -> sudo /usr/bin/wget -O /dev/null -q http://mydomain.com/cron.php
-> I got email notification every minute:
sudo: no tty present and no askpass program specified
ok, I see, forget about sudo - you run this command, but user not in sudoers.
Top

sim
Posts: 101
Joined: Sat Nov 22, 2014 7:47 pm

Re: Cron job problem ...
  • Quote

Post by sim » Thu Jan 15, 2015 9:10 am

You don't need root privileges to run wget.
Remove the sudo.
Top

247x
Posts: 3
Joined: Wed Jan 14, 2015 7:56 pm

Re: Cron job problem ...
  • Quote

Post by 247x » Thu Jan 15, 2015 9:24 am

sim wrote:You don't need root privileges to run wget.
Remove the sudo.
That's what I have done and now cron job runs every 16th minute for some reason which I can not figure out why ...
-> I have set it to run every minute ...
* * * * * /usr/bin/wget -O /dev/null -q http://mydomain.com/cron.php
Top


Post Reply
  • Print view

6 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password