Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 24th July 2010, 03:27
MrCompTech MrCompTech is offline
Member
 
Join Date: Jul 2010
Posts: 92
Thanks: 1
Thanked 20 Times in 9 Posts
Default Problem getting cron job to run and in need of help :)

The website is "infiniteresponder.mrcomptech.com".
The cron job I created is :

Code:
*       *       *       *       *       web14   /usr/bin/php web/sendmails.php > /dev/null
I have confirmed that web14 is for "infiniteresponder.mrcomptech.com".

Running this from a SSH connection as mct_infres, the ssh user for infiniteresponder.mrcomptech.com works.
Code:
/usr/bin/php web/sendmails.php > /dev/null
After logging in as mct_infres the PWD is "/var/www/clients/client1/web14"
running ls -l as mct_infres:
Code:
dr-xr-xr-x 2 web14 client1 4096 Jul 22 20:09 bin
drwxr-x--x 2 web14 client1 4096 Jul 22 16:27 cgi-bin
drwxr-xr-x 2 web14 client1 4096 Jul 22 20:09 dev
drwxr-xr-x 3 root  root    4096 Jul 22 20:39 etc
drwxr-xr-x 3 web14 client1 4096 Jul 22 20:09 home
dr-xr-xr-x 3 web14 client1 4096 Jul 22 20:09 lib
dr-xr-xr-x 2 web14 client1 4096 Jul 22 20:09 lib64
lrwxrwxrwx 1 web14 client1   57 Jul 22 16:27 log -> /var/log/ispconfig/httpd/infiniteresponder.mrcomptech.com
drwxr-x--x 2 web14 client1 4096 Jul 22 16:27 ssl
drwxrwxrwx 2 web14 client1 4096 Jul 23 17:40 tmp
drwxr-xr-x 7 root  root    4096 Jul 22 20:09 usr
drwxr-xr-x 3 root  root    4096 Jul 22 20:09 var
drwx--x--- 7 web14 client1 4096 Jul 22 21:59 web
After creating the cron job and then running server.sh I get this error twice:
Code:
ERROR: /var/www/clients/client1/web14/bin is not owned by root:root!
This is correct, user web14 and group client1 own this folder.
I thought this should be running as web14 not root, so I don't understand what is happenging here.
If I try making the owner and group root:root then things just get worse.
Here is the complete debug output after creating the cron job and running server.sh:
Code:
23.07.2010-19:43 - DEBUG - Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
23.07.2010-19:43 - DEBUG - Found 1 changes, starting update process.
23.07.2010-19:43 - DEBUG - Call function 'insert' in plugin 'cron_jailkit_plugin' raised by event 'cron_insert'.
23.07.2010-19:43 - DEBUG - exec: chmod 755 /var/www/clients/client1/web14
23.07.2010-19:43 - DEBUG - exec: chown root:root /var/www/clients/client1/web14
ERROR: /var/www/clients/client1/web14/bin is not owned by root:root!
23.07.2010-19:43 - DEBUG - Added programs to jailkit chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_programs.sh /var/www/clients/client1/web14 '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano'
ERROR: /var/www/clients/client1/web14/bin is not owned by root:root!
23.07.2010-19:43 - DEBUG - Added cron programs to jailkit chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_programs.sh /var/www/clients/client1/web14 '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php'
usermod: no changes
23.07.2010-19:43 - DEBUG - Added jailkit user to chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_user.sh web14 /var/www/clients/client1/web14 /home/web14 /bin/bash
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
23.07.2010-19:43 - DEBUG - exec: chmod 755 /var/www/clients/client1/web14
23.07.2010-19:43 - DEBUG - exec: chown root:root /var/www/clients/client1/web14
23.07.2010-19:43 - DEBUG - Jailkit Plugin (Cron) -> insert username:web14
23.07.2010-19:43 - DEBUG - Call function 'insert' in plugin 'cron_plugin' raised by event 'cron_insert'.
23.07.2010-19:43 - DEBUG - Deleted Cron file /etc/cron.d/ispc_web14
23.07.2010-19:43 - DEBUG - Wrote Cron file /etc/cron.d/ispc_chrooted_web14 with content:
MAILTO=''

SHELL='/usr/sbin/jk_chrootsh'

*       *       *       *       *       web14   /usr/bin/php web/sendmails.php > /dev/null

23.07.2010-19:43 - DEBUG - Processed datalog_id 526
23.07.2010-19:43 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
finished.
And in the System Log I get this repeated every minute until deleting the cron job:
Code:
Jul 23 19:46:01 prl-ofc-s01 jk_chrootsh[27195]: path /var/www/clients/client1/web14/dev/ is not owned by user 0
Jul 23 19:46:01 prl-ofc-s01 jk_chrootsh[27195]: path /var/www/clients/client1/web14/dev/ is not owned by group 0
Jul 23 19:46:01 prl-ofc-s01 jk_chrootsh[27195]: abort, /var/www/clients/client1/web14 is not a safe chroot jail.
And from reading another similar thread I created both ftp and ssh users for this web site, but that has not corrected the problem.
Reply With Quote
Sponsored Links
  #2  
Old 24th July 2010, 10:35
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,022
Thanks: 840
Thanked 5,655 Times in 4,464 Posts
Default

The path web/sendmails.php is wrong. You have to use the absolute path to the script starting with a /

Quote:
Jul 23 19:46:01 prl-ofc-s01 jk_chrootsh[27195]: path /var/www/clients/client1/web14/dev/ is not owned by user 0
You seem to have added a folder dev in /var/www/clients/client1/web14 which is not owned by root and this prevents the creation of the cronjob jail. Remove this folder or chown it to root.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 24th July 2010, 23:08
MrCompTech MrCompTech is offline
Member
 
Join Date: Jul 2010
Posts: 92
Thanks: 1
Thanked 20 Times in 9 Posts
Default Is there a way to run a users cron job from the command prompt?

I changed the path in the cron job and chown the dev directory to root.
Quote:
You seem to have added a folder dev in /var/www/clients/client1/web14 which is not owned by root and this prevents the creation of the cronjob jail. Remove this folder or chown it to root.
I did not create the /var/www/clients/client1/web14/dev/ folder.
I looked closer at the output below and can see were the system created these folders.

I have four web sites for this client and only one had a cron job created for it, infiniteresonder.mrcomptech.com --> web14.
And that is the only web site that has 'extra' folders in it.

The other three have these folders:
cgi-bin, log (symlink), ssl, tmp and web

But the site that I created the cron job for has these additional folders, none of which I created:
bin, dev, etc, home, lib, lib64, usr, var

Working in the /var/www/clients/client1/web14/ folder -

I chown on dev then it says group 0 does not own dev so I 'chgrp root dev'.
Then an error in the system-log says that 'bin' is not owned by root:root, so I changed it that same way.
Then yet another error for anothe "extra" folder has the same error.
So all the extra folder I made the chown:chgrp root:root.

After making these changes I deleted the cron job, ran server.sh, recreated the cron job ran server.sh again and this is what I got:

Code:
[root@prl-ofc-s01 client1]# /usr/local/ispconfig/server/server.sh
24.07.2010-14:08 - DEBUG - Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
24.07.2010-14:08 - DEBUG - Found 1 changes, starting update process.
24.07.2010-14:08 - DEBUG - Call function 'insert' in plugin 'cron_jailkit_plugin' raised by event 'cron_insert'.
24.07.2010-14:08 - DEBUG - exec: chmod 755 /var/www/clients/client1/web14
24.07.2010-14:08 - DEBUG - exec: chown root:root /var/www/clients/client1/web14
24.07.2010-14:08 - DEBUG - Added programs to jailkit chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_programs.sh /var/www/clients/client1/web14 '/usr/bin/groups /usr/bin/id /usr/bin/dircolors /bin/basename /usr/bin/dirname /usr/bin/nano'
24.07.2010-14:09 - DEBUG - Added cron programs to jailkit chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_programs.sh /var/www/clients/client1/web14 '/usr/bin/php /usr/bin/perl /usr/share/perl /usr/share/php'
usermod: no changes
24.07.2010-14:09 - DEBUG - Added jailkit user to chroot with command: /usr/local/ispconfig/server/scripts/create_jailkit_user.sh web14 /var/www/clients/client1/web14 /home/web14 /bin/bash
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
24.07.2010-14:09 - DEBUG - exec: chmod 755 /var/www/clients/client1/web14
24.07.2010-14:09 - DEBUG - exec: chown root:root /var/www/clients/client1/web14
24.07.2010-14:09 - DEBUG - Jailkit Plugin (Cron) -> insert username:web14
24.07.2010-14:09 - DEBUG - Call function 'insert' in plugin 'cron_plugin' raised by event 'cron_insert'.
24.07.2010-14:09 - DEBUG - Deleted Cron file /etc/cron.d/ispc_web14
24.07.2010-14:09 - DEBUG - Wrote Cron file /etc/cron.d/ispc_chrooted_web14 with content:
MAILTO=''

SHELL='/usr/sbin/jk_chrootsh'

*       *       *       *       *       web14   /usr/bin/php /web/sendmails.php > /dev/null

24.07.2010-14:09 - DEBUG - Processed datalog_id 548
24.07.2010-14:09 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
finished.
This appears to be without error except for:
Code:
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
But the cron job still doesn't to run, I know this because when it runs I do not get the emails from the autoresponder.
I logged in with the ssh account created for this website and tried to run what the cron job wold run.

/usr/bin/php /web/sendmails.php > /dev/null, but without the " > /dev/null" so I could see the outout and the result was:

Could not open input file: /web/sendmails.php

So I ran /usr/bin/php web/sendmails.php (without the beginning /), and the e-mails were immediatley delivered to my inbox.

To bring things some what back to a starting point I deleted the cron job, ran server.sh then recreated the cron job with the path as 'web/sendmails.php' re-ran server.sh, other than the 'usermod' issue above the script server.sh ran correctly.

Still no joy, no e-mails

Waited a couple of minutes for the System-Log in ISPConfig3 to update and the erro rmessage was:
Code:
path /var/www/clients/client1/web14/./home/web14 is not owned by user 5015
5015 is web14, Which can be seen in the /etc/passwd file (vim /etc/passwd, then search for "/" 5015)
So I but the "/" back in the path of the cron job and "chown web14:client1 home" while in the directory "/var/www/clients/client1/web14"

Still no joy, so changed path in cron job to "./web/sendmails.php"
Waited a about 10 minutes the checked the system log again.
Error as still :
Code:
Jul 24 14:46:01 prl-ofc-s01 jk_chrootsh[22223]: path /var/www/clients/client1/web14/./home/web14 is not owned by user 5015
Jul 24 14:46:01 prl-ofc-s01 jk_chrootsh[22223]: path /var/www/clients/client1/web14/./home/web14 is not owned by group 5005
So ran "chown web14:client1 web14" after cd to "/var/www/clients/client1/web14/./home/"

Again waiting a while for log file entries...

Now in the system log:
Code:
Jul 24 15:21:01 prl-ofc-s01 jk_chrootsh[23681]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:22:01 prl-ofc-s01 jk_chrootsh[23760]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:23:01 prl-ofc-s01 jk_chrootsh[23798]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:24:01 prl-ofc-s01 jk_chrootsh[23838]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:25:01 prl-ofc-s01 jk_chrootsh[23890]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
And When I delete the cron job, run server.sh then recreate the cron job and re-run server.sh I now get no errors and not even the "usermod -p" command as the log indicated, even though I did NOT run the usermod -p command.

Quote:
usermod: unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password.
So I changed the cron job back to "/usr/bin/php /web/sendmails.php > /dev/null", waited a while again.

Still not getting the e-mails but if I log in via SSH as the web site user and run "/usr/bin/php web/sendmails.php" then I get 2 e-mails, I have them set to be sent every 3 minutes while testing.

So, It seems that the cron job is running every minute as scheduled without errors. At least there were no errors at the command prompt when running server.sh as root just immediately after creating the cron job. And there are no errors in the ISPConfig3 System-Log. I have never seen any entries in the ISPConfig3 "ISPC Cron-Log".

I edited this the cron job saved in "/etc/cron.d/ispc_chrooted_web14" to add an e-mail notification by
changing MAILTO=''
to MAILTO='mrcomptech@mrcomptech.com' which is the same account the autoresponder should be sending the test messages to.

I have sent mail to and from this email address to both, accounts on this server and my yahoo.com e-mail account with no problems.

Since making the MAILTO change the cron job has run several times as indicated by the System-Log entries:

Code:
Jul 24 15:46:01 prl-ofc-s01 jk_chrootsh[24929]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:47:01 prl-ofc-s01 jk_chrootsh[24971]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:48:01 prl-ofc-s01 jk_chrootsh[25004]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:49:01 prl-ofc-s01 jk_chrootsh[25033]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
Jul 24 15:50:01 prl-ofc-s01 jk_chrootsh[25063]: now entering jail /var/www/clients/client1/web14 for user web14 (5015)
But I did not get any e-mails at all from the cron job.
But again logging in as the ssh user for this website and runing "/usr/bin/php ./web/sendmails.php" which is very similar to the cron job I get the e-mails from the autoresponder.

And just to be clear the cron job is currently "/usr/bin/php /web/sendmails.php > /dev/null" for the website "infiniteresponder.mrcomptech.com" which is for client1 user web14.

To help with troubleshooting -
Is there a way to manually run or trigger the cron job to run while at an ssh prompt for the website user?
Reply With Quote
  #4  
Old 24th July 2010, 23:34
MrCompTech MrCompTech is offline
Member
 
Join Date: Jul 2010
Posts: 92
Thanks: 1
Thanked 20 Times in 9 Posts
Default Cron job appears to be missing

When logged in as root and run 'crontab -l' to list cron jobs all that is listed is:
Code:
* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null
30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null
When logged in as the website user and run 'crontab -l' to list cron jobs all that is listed is:
Code:
no crontab for web14
So once every minute, the schedule of the cronjob in ISPConfig3 for the website I see in the log
Code:
now entering jail /var/www/clients/client1/web14 for user web14
But actions that should be taken place by this cron job don't happen and I cannot find any errors to help me find the problem.
Reply With Quote
  #5  
Old 25th July 2010, 01:06
MrCompTech MrCompTech is offline
Member
 
Join Date: Jul 2010
Posts: 92
Thanks: 1
Thanked 20 Times in 9 Posts
Default Cron jobs don't run even when logged in ssh as website user.

I tried creating the cron job after logging in as the website user.

crontab -e

created job
Code:
*       *       *       *       *       /usr/bin/php ./web/sendmails.php > /dev/null
But cron emails web site user error message:
Code:
Could not open input file: ./web/sendmails.php
so tried changing job to
Code:
*       *       *       *       *       /usr/bin/php /web/sendmails.php > /dev/null
and still get the same error
Code:
Could not open input file: /web/sendmails.php
Running the command from the command prompt as the website user -
Code:
/usr/bin/php /web/sendmails.php
results in
Code:
Could not open input file: /web/sendmails.php
But running command at command prompt
Code:
/usr/bin/php ./web/sendmails.php
works.

Any help on getting cron jobs configured under ISPConfig3 would be greatly appreciated!
Reply With Quote
  #6  
Old 25th July 2010, 11:19
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,022
Thanks: 840
Thanked 5,655 Times in 4,464 Posts
Default

Normally you run such a sendmail.php file like this as cronjob:

/usr/bin/wget http://www.yourdomain.com/sendmail.php

and not with the commandline php interpreter which might be unavailable in the jailed cron enviroment.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
MrCompTech (26th July 2010)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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