View Single Post
  #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