HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Crons not running from Sites -> Crons (http://www.howtoforge.com/forums/showthread.php?t=47735)

ethanlifka 3rd August 2010 23:05

Crons not running from Sites -> Crons
 
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

till 4th August 2010 09:37

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

ethanlifka 14th August 2010 23:21

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?

wahid 17th August 2010 15:04

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?

Mark_NL 17th August 2010 16:35

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

wahid 17th August 2010 16:52

...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?

wahid 20th August 2010 14:17

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.

Mark_NL 20th August 2010 16:30

what's inside BackupWpress.sh?

wahid 20th August 2010 17:03

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


Mark_NL 20th August 2010 19:36

is nice available from jailroot as well?


All times are GMT +2. The time now is 12:12.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.