Crons not running from Sites -> Crons

Discussion in 'Installation/Configuration' started by ethanlifka, Aug 3, 2010.

  1. ethanlifka

    ethanlifka New Member

    Whenever I create a cron using the Sites->Cron Jobs they wont run. However the same crons run fine in crontab.

    Not only that they are not running, but there is no output.

    I noticed that when creating a Client it has settings for Crons, But I only have one site and therefore have no clients.
    I am doing it all from my admin.

    Is that why the crons are not running?

    Does the Admin by default have no Cron Authority?

    I am using CentOS 5.4, ISPC 3.0.1.6
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Most likely you try to start progrems with cron that are not within the jail of the cronjob.
     
  3. ethanlifka

    ethanlifka New Member

    I am just trying to run a php file.

    0 * * * * /usr/bin/php -q /var/www/clients/client0/web1/cron.php &> /dev/null


    I don't want to use Wget cause I like to keep my crons private. I know there are ways to protect public cron files, but i still like them in the private folder.

    This cron runs fine in crontab, but when in Sites -> Cron it wont run.
    The file and folder are owned by the web1 user.

    I am getting no output or logging.

    Does a client have to be created in order to run the cron?
     
  4. wahid

    wahid New Member

    I'm getting the same problem with a simple backup.sh Script, which I tried to run with the default admin client to backup my website automatically.
    So I went through the Cron-Menu in ISPConfig adding a record which contains:
    Code:
    0      0     *      *       0       web5    /var/www/clients/client0/web5/BackupScript.sh
    I created previously a shell user for the concerned website, who has "none" for the Chroot Shell option.

    When I looked into /var/log/ispconfig/cron.log, there was no output and some errors are shown:
    Code:
    /usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh: line 24: jk_init: command not found
    mkdir: cannot create directory `/var/www/clients/client0/web5/var': File exists
    mkdir: cannot create directory `/var/www/clients/client0/web5/var/run': File exists
    mkdir: cannot create directory `/var/www/clients/client0/web5/var/run/mysqld': File exists
    ln: creating hard link `/var/www/clients/client0/web5/var/run/mysqld/mysqld.sock': File exists
    /usr/local/ispconfig/server/scripts/create_jailkit_programs.sh: line 20: jk_cp: command not found
    /usr/local/ispconfig/server/scripts/create_jailkit_programs.sh: line 20: jk_cp: command not found
    /usr/local/ispconfig/server/scripts/create_jailkit_user.sh: line 25: jk_jailuser: command not found
    usermod: no changes
    
    When I run manually the script with the user "web5", everything works out of the box.

    So what's missing?
     
  5. Mark_NL

    Mark_NL Member

    I've been having problems with crons as well in the past .. the thing is, stuff like PATH env vars aren't there, or aren't the same as if you'd run them from the CLI ..

    especially when you jailroot .. you ned to make sure the files you need are within your root
     
  6. wahid

    wahid New Member

    ...but even I create a non-chroot shell user, I assume that ISPConfig is still assigning the new created user jailroot attributes :confused: !
    So this is what I found in the created crontab:
    Code:
    MAILTO=''
    
    SHELL='/usr/sbin/jk_chrootsh'
    
    45	16	*	*	2	web5     /BackupWpress.sh
    
    As said even I assign it "none" by the chroot option, you see here the cronjob got something related to jailrooted users "SHELL='/usr/sbin/jk_chrootsh'"

    And I used of course full path in my script ! Unforunately this feature is really still confusing on ispconfig.

    Any idea?
     
  7. wahid

    wahid New Member

    I decided to give up and set up a crontab manually to perform the backup. It seems not working at all when I use ISPConfig.
     
  8. Mark_NL

    Mark_NL Member

    what's inside BackupWpress.sh?
     
  9. wahid

    wahid New Member

    This simple script:

    Code:
    #!/bin/sh
    
    
    # Backup "website.tld" /var/www/clients/client0/web5/web
    nice -n 17 /bin/tar -cjvvf /var/www/clients/client0/web5/backups/website.tld.`/bin/date +%Y%m%d`.tar.bz2 /var/www/clients/client0/web5/web
    
    # Dump "website.tld" Website database
    nice -n 17 /usr/bin/mysqldump --verbose --user=userName --password=secret --add-drop-table dbName> /var/www/clients/client0/web5/backups/website.tld.`/bin/date +%Y%m%d`.sql
    nice -n 17 /bin/bzip2 /var/www/clients/client0/web5/backups/website.tld.`/bin/date +%Y%m%d`.sql
    
    
     
  10. Mark_NL

    Mark_NL Member

    is nice available from jailroot as well?
     
  11. wahid

    wahid New Member

    Anyway "nice" worked even I didn't put the full path for it, and the script was executed without any error on the mailed log.
     
  12. ethanlifka

    ethanlifka New Member

    So far I havent been able to get the default admin crons to work.
    Just keeping in the crontab for now.

    If you find a solution to run crons from the default admin then let me know.

    Thanks
     

Share This Page