Cron Jobs

Discussion in 'General' started by galius, Dec 4, 2013.

  1. galius

    galius New Member HowtoForge Supporter

    Hello,

    My system: Debian GNU / Linux 7
    My ISPConfig: 3.0.5.3

    I created a user with the domain etc and also the right to create Cron jobs and shell access via ssh.

    When I run this command:
    Code:
    ***** cd / var/www/clients/client2/web2/web/home/crm; php-f cron.php> / dev / null 2​​> & 1
    nothing happens. I have declared this in the command pannel ISPConfig.

    if I run this command

    Code:
    crontab -l
    in the shell, this is the message I have

    Code:
    bash: crontab: command not found
    If I login by ssh as root and if I type this command,

    Code:
    crontab -l
    here is the result

    Code:
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    30 00 * * * /usr/local/ispconfig/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    
    My client uses Sugar CRM and wants to plan some tasks. Can someone help me?

    Thank you
     
  2. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Is this the exact command you entered?
    It contains errors.
    First there is a space after "cd /" in front of the var/www
    Second there is NO space between php and -f

    Has the client rights to create FULL cron or only CHROOTed?
     
  3. galius

    galius New Member HowtoForge Supporter

    Thanks Croydon for your fast reply.

    like this?

    Code:
    cd /var/www/clients/client2/web2/web/home/crm; php-f cron.php > /dev/null 2>&1 
    Yes, my client is in CHROOTED mode...

    B.regards,
     
  4. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    In chrooted mode you cannot use the php binary until you added it to the jail.
    You have to use full cron or add it to the jail what could be some work.

    Despite of that your command is still wrong.
    Code:
    cd /var/www/clients/client2/web2/web/home/crm; php -f cron.php > /dev/null 2>&1
    (mind the space before -f)
    this would only work in full mode.

    In chrooted mode you would use
    Code:
    cd /web/home/crm; php -f cron.php > /dev/null 2>&1
    But as I said only if php is available inside the jail.
     
  5. galius

    galius New Member HowtoForge Supporter

    Ok, I see...

    I changed the ssh access to my client. He is no longer chrooted now. By ssh I type the command:

    Code:
    cd / var/www/clients/client2/web2/web/home/crm
    then

    Code:
    php-f cron.php> / dev / null 2​​> & 1
    And I have no error message.

    But if I do:

    Code:
    crontab-l
    I have this response:

    Code:
    command not found
    So I logged in as root user to see the crontab, and here is the answer:

    Code:
    * * * * * /usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    
    30 00 * * * /usr/local/ispconfig/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
    how to check that the crontab of my client being well taken care account?
    Thank you for your time ...

    Regards,
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Cronjobs are no stored in the crontab, they are stored in /etc/cron.d/

    Also your cronjob can not eork as all libux cronjobs hve to use full paths to files and binaries as the linux cron system does not know the value of the path variable.
     
  7. budgierless

    budgierless Member HowtoForge Supporter

    Hi am also having an issue, i am trying to fix my cron also, I have adjusted it now, how dose this look?

    */11 * * * * web11 /usr/bin/php -q /var/www/clients/client0/web11/web/cron.php > /dev/null &
     
  8. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    That depends on multiple things …
    Is this cron job in /etc/cron.d/xxxx or in /etc/crontab or in /var/spool/cron/crontabs/xxxx ? Is it chrooted or full cron job?
    Why */11? This would run on x:11, x:22, x:33, x:44, x:55. So from x:55 to x:11 it pauses 16 minutes.
     
  9. budgierless

    budgierless Member HowtoForge Supporter

    Your right, I will change it to */10 instead, I am use ispconfig cron panel which is /etc/cron.d/

    My issue is that I had this cronjob running on my old server, but on my new system with ispconfig, the cron doesn't work, even though I have setup the cron job in ispconfig is there any extra permission I have to invoke? Also just so you know the cron is attempting to use the default php5 which is the same version and location as it was on the previous system,
    Please advise?
     
  10. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    You have to check if the job is chrooted or not. You can see it by looking at the file name of the cron.
     
  11. budgierless

    budgierless Member HowtoForge Supporter

    Im sorry i dont know what you mean about chrooted? if you mean the file owner permission then it is set to web11:client0
     
  12. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    What is the filename of your cron file?
     
  13. budgierless

    budgierless Member HowtoForge Supporter

    it is, cron.php as shown above?

    EDIT: In /etc/cron.d I see that under MAILTO is sh bash shell, if all my cron's are only php, should i change it to /usr/bin/php ?
     
    Last edited: Feb 10, 2015
  14. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    No, of course not.
    You should check the syslog for the dates of the cron run. Maybe there is an error.
     
    budgierless likes this.

Share This Page