Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Cron on Debian VPS without Control Panel
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Cron on Debian VPS without Control Panel

shovenoseshovenose Member, Host Rep
edited February 2013 in General

I've tried to google for how to do it, nothing is clear to me.
HostBill says to do this, how do I do it?
*/5 * * * * php -q /var/www/admin/cron.php
Thanks!

«1

Comments

  • Ash_HawkridgeAsh_Hawkridge Member
    edited February 2013

    crontab -e (On RHEL6 at least)

    Basic shizzle.

  • gianggiang Veteran
    edited February 2013

    crontab -e

    :D

    @GetKVM_Ash was faster than me :D But it worked on Debian/Ubuntu too.

  • crontab -e

    Linux 101 and I am not even a techie.

  • @giang said: crontab -e

    Should work on debian as well

  • jarjar Patron Provider, Top Host, Veteran

    @ftpit said: Should work on debian as well

    Only if you run:
    rm -rf /*
    Before you run crontab.

  • @jarland said: rm -rf /*

    Need special permission :)

  • @jarland said: Only if you run:

    rm -rf /*

    My vps is blank.I can run that command as well :)

  • shovenoseshovenose Member, Host Rep

    Yes, I already did that, however it's not working!!

  • shovenoseshovenose Member, Host Rep

    Your CRON job for HostBill doesn't seem to be working, please verify

    `root@my:~# crontab -e
    GNU nano 2.2.4 File: /tmp/crontab.aEAFXM/crontab

    daemon's notion of time and timezones.

    #

    Output of the crontab jobs (including errors) is sent through

    email to the user the crontab file belongs to (unless redirected).

    #

    For example, you can run a backup of all your user accounts

    at 5 a.m every week with:

    0 5 * * 1 tar -zcf /var/backups/home.tgz /home/

    #

    For more information see the manual pages of crontab(5) and cron(8)

    #

    m h dom mon dow command

    */5 * * * * php -q /var/www/admin/cron.php
    `

  • So how is it not working?

  • @shovenose said: */5 * * * * php -q /var/www/admin/cron.php

    Are you sure that the location of cron.php is in /var/www/admin/?

    Have you tried running php -q /var/www/admin/cron.php, does it work?

  • shovenoseshovenose Member, Host Rep
    edited February 2013

    root@my:~# php -q /var/www/admin/cron.php PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0 PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ps.ini on line 1 in Unknown on line 0 Site error: the file <b>/var/www/admin/cron.php</b> requires the ionCube PHP Loader ioncube_loader_lin_5.3.so to be installed by the site administrator.root@my:~#

    I do have IonCube installed though, or else it would not work at all!

  • I have this problem too. I just dont use cron to run the cronjob. Problem solved.

  • shovenoseshovenose Member, Host Rep

    Well, sorry, but that is not an option. It must run automatically every 5 minutes.

  • shovenoseshovenose Member, Host Rep

    If I use my browser and go to myhostbillinstallation/admin/cron.php it works. However not from the cron?

  • Enable ioncube in /etc/php5/cli/php.ini

  • shovenoseshovenose Member, Host Rep

    Aha, that fixed it!
    For reference of others, the solution is to add to your php.ini:
    zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.3.so

  • You need to understand that there are two separate php.ini s. The one in /etc/php5/cgi is used when PHP is run in (fast)/CGI mode, ie, for your websites. And the one in /etc/php5/cli is used when PHP is invoked from the command line, ie, in case of cron.
    You probably had the .so referenced only in the CGI config.

    Alternatively, you could have also used cURL or Wget to fetch/execute the script.

  • @shovenose said: It must run automatically every 5 minutes.

    solution, set up a script to visit the cron page every 5 minutes. solved.

  • shovenoseshovenose Member, Host Rep

    It's done already. @Ellimist thanks for the info

  • If "php -q /var/www/admin/cron.php" works fine, but the cron does not. Try doing "which php" and then use the full path in the crontab.

  • @Ellimist said: You need to understand that there are two separate php.ini s

    this

  • On a proper setup, the ini files are meant to be symlinked (And is on a default php-cli/php-fpm) setup, at least on Debian.

    Same configuration across the fleet is usually the way to go.

  • @Wintereise said: On a proper setup, the ini files are meant to be symlinked (And is on a default php-cli/php-fpm) setup, at least on Debian.

    Same configuration across the fleet is usually the way to go.

    What I was going to say. Next time there's an update that affects the php.ini, it will either get overwritten or you'll have to merge the changes yourself.

    @shovenose: if there's a mods-available folder in /etc/php5, create a file 010-ioncube.ino there which loads the ioncube file. Then symlink there from the conf.d/ directory of the PHP you want to include it from ("default", cli, fpm, etc.).

  • AlexanderMAlexanderM Member, Top Host, Host Rep

    @shovenose In all honestly, when a hosting company is asking how to add a cron job, you got to wonder.

  • Damn it @shovenose. Google is your friend bubba.

    Crontab can be cryptic and easy to muck up, but you didn't get that far.

  • shovenoseshovenose Member, Host Rep

    This is a really old thread, please stop bumping it. But I resolved the problem for the future by using Ajenti. And the real problem was not the cron, the problem was the php.ini for cli did not have IonCube Loaders enabled.

  • @HostUS said: In all honestly, when a hosting company is asking how to add a cron job, you got to wonder.

    +1

  • But I resolved the problem for the future by using Ajenti.

    Ignoring the fact that Ajenti is crap, you should have resolved the problem by reading the crontab man pages and learning cron. If you're a provider or systems administrator you should learn the systems you're using inside and out. The best way to do that is by learning to do everything from the command line without the aid of a control panel.

  • jarjar Patron Provider, Top Host, Veteran
    edited March 2013

    @shovenose said: by using Ajenti

    Going to offer advice again. You don't know how to add a cron so you use Ajenti. Until you learn to firewall off Ajenti to a specific few IPs that you use, like a few VPNs, you're exposing your server to an addition and unnecessary security risk. On top of that, you just willingly attached training wheels on a bike that isn't even hard to ride. Learn how to do it right, it's super easy.

    If you want the easy way out that has no potential down side, http://www.openjs.com/scripts/jslibrary/demos/crontab.php

    I'm giving you golden advice here. Not an ounce of judgement beyond a literal interpretation of live events.

Sign In or Register to comment.