problem with cronjob

Discussion in 'General' started by davide.seo, Nov 22, 2011.

  1. davide.seo

    davide.seo New Member

    Hi all, I have a problem configuring a cron jobs in the web panel of ispconfig3 ( Site->Cron jobs ).
    In the detail, after configured a cron jobs that executes every minute, in the auth.log file I see this message:

    Nov 21 20:42:12 164-44 usermod[15799]: change user 'web9' home from '/var/www/clients/client0/web9' to '/var/www/clients/client0/web9/.'
    Nov 21 20:42:12 164-44 usermod[15799]: change user 'web9' shell from '/bin/false' to '/usr/sbin/jk_chrootsh'
    Nov 21 20:42:12 164-44 usermod[15804]: change user 'web9' home from '/var/www/clients/client0/web9/.' to '/var/www/clients/client0/web9/./home/web9'
    Nov 21 20:42:12 164-44 CRON[13244]: pam_unix(cron:session): session closed for user root
    Nov 21 20:43:01 164-44 CRON[15822]: pam_unix(cron:session): session opened for user web9 by (uid=0)
    Nov 21 20:43:01 164-44 CRON[15823]: pam_unix(cron:session): session opened for user root by (uid=0)
    Nov 21 20:43:01 164-44 jk_chrootsh[15824]: path /var/www/clients/client0/web9/./home/web9 is not owned by user 5008
    Nov 21 20:43:01 164-44 jk_chrootsh[15824]: path /var/www/clients/client0/web9/./home/web9 is not owned by group 5005
    Nov 21 20:43:01 164-44 jk_chrootsh[15824]: abort, path /var/www/clients/client0/web9/./home/web9 is not owned by 5008.

    In the directory I see this tree:
    drwx--x--- 4 web9 client0 4096 2011-10-19 20:39 web
    lrwxrwxrwx 1 root root 4 2011-11-21 20:42 lib64 -> /lib
    drwxr-xr-x 3 root root 4096 2011-11-21 20:42 var
    drwxr-xr-x 2 root root 4096 2011-11-21 20:42 dev
    drwxr-xr-x 6 root root 4096 2011-11-21 20:42 usr
    drwxr-xr-x 2 root root 4096 2011-11-21 20:42 bin
    drwxr-x--x 3 root root 4096 2011-11-21 20:42 lib
    drwxr-x--- 3 root root 4096 2011-11-21 20:42 home
    drwxr-xr-x 6 root root 4096 2011-11-21 21:13 etc



    so I decide to chown the directory home:

    root@webhosting:/var/www/clients/client0/web9# chown -R web9:client0 home



    after this I see in the syslog file the message:
    Nov 21 20:47:01 164-44 jk_chrootsh[15980]: now entering jail /var/www/clients/client0/web9 for user web9 (5008) with arguments -c /var/www/clients/client0/web9/myscript.sh

    but nothing happens on the script.
    But ispconfig works well only if I set http url to wget. Could you help me ?

    I show also the /etc/passwd file:

    web7:x:5006:5005::/var/www/clients/client0/web7/:/bin/false
    web8:x:5007:5005::/var/www/clients/client0/web8:/bin/false
    web9:x:5008:5005::/var/www/clients/client0/web9/./home/web9:/usr/sbin/jk_chrootsh
    web10:x:5009:5005::/var/www/clients/client0/web10:/bin/false
    web11:x:5010:5005::/var/www/clients/client0/web11:/bin/false
    web12:x:5011:5005::/var/www/clients/client0/web12:/bin/false



    Thank you
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Most likely you use commands in myscript.sh which are not installed inside the jail or you dont use full paths for the commands. Please post the content of myscript.sh.
     
  3. davide.seo

    davide.seo New Member

    Hi till, thank you for the reply. This is the content:

    root@webhosting:/var/www/clients/client0/web9/home/web9# vi myscript.sh

    /usr/bin/wget http://www.cxxxieremilano.it/xx/xxxxx/cron/cron.php
    ( url is clouded, wget exists in the relative path )
    Calling this url from browser I should see a new parameter in the db via phpmyadmin but I don't see nothing. If I insert an echo command in the script, could I see the output in any log ?
    Thanks
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The wget application is normally not installed in the jail if you use a jailed cronjob, so this script can not work.

    But why do you use this script at all? ISPConfig offers URL cronjobs for that purpose and they do exactly the same then your script. So the right solution for your problem is to create a cronjob in ISPConfig and just add:

    http://www.cxxxieremilano.it/xx/xxxxx/cron/cron.php

    in the command field.
     
  5. davide.seo

    davide.seo New Member

    Oh yes, I know that I can use the url in the cron job field but I used this script to test if the cron jobs works well.
    You say that wget is not installed but I see it in the jail path:

    root@webhosting:/var/www/clients/client0/web9/usr/bin# ls
    awk clear dircolors du ftp head id less mawk nano nice php pico scp ssh tail vi vim.nox wc whoami
    basename cut dirname find groups host ldd lesspipe md5sum netkit-ftp perl php5 rsync sort tac tr vim watch wget
    root@webhosting:/var/www/clients/client0/web9/usr/bin#

    Have you an idea to test the cron job functionality indipendently from my url ?
    Thanks
     
  6. davide.seo

    davide.seo New Member

    ok...solved the problem ;)

    I inserted the command: /bin/touch pippo and it created the file :)
    Thank you
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    If you have the echo command in /var/www/clients/client0/web9/bin, then you can e.g. use such a cronjob:

    echo 'test' > /tmp/test

    you should find a file called test then in the tmp folder of the website. You can also verify cron by using a URL cron as I suggested, if the value in your db gets incremented, then it works.
     

Share This Page