Current time: 07-04-2020, 06:31 PM Hello There, Guest! (LoginRegister)


Thread Closed 
[HowTO] add cronjob on Debian Lenny Improved
Author Message
xtc007 Offline
Junior Member
*

Posts: 26
Joined: Dec 2009
Reputation: 0
Post: #1
[HowTO] add cronjob on Debian Lenny Improved
There's my How to for adding cronjobs on ispcp 1.0.3

I have worked hard to take all pieces of information every where and put all togheter to be up and running on Debian...

i speak french and english, but for this task i have learn to read german Tongue (i like my translator hehehehe), every post have been read 3-4 times to run against every little bug!, but my cron are working very fine now!

Many step have been taken on the forum, i have find some step myself, they are possibly on but i didn't find them in on

i have also corrected the original cronjob_XXXXXXX.php for white square apprear on upper right
image not exists on ispcp 1.0.3 (probably ok in other revision)

the cronjob delete error are fixed on ispcp 1.0.3
/admin/user_delete.php are updated
/reseller/domain_delete.php are updated

the mysql table have been modified to be able to fix the deletion as stated before

added table field in cronjob addition,

All step to be installed succesfully on 2 Debian server are here...

install these library first

apt-get install flex
apt-get install gettext
apt-get install libdaemon-dev
apt-get install libmysqlclient15-dev

add table to ispcp database with the sql file in root folder provided

Install the provided hcrond "original hcrond from sourceforge"(i have modified to specification of data-stream_ru, i fixed a typing error when hcrond is compiled they not start, the select structure are wrong in the *) area it's fixed)
just do a make -B install "an constant error will be displayed, no matter, if you read the code, the author tell you why, and no problem about using it"

edit the /etc/hcrondrc to reflect your installation

Run hcrond at startup
update-rc.d hcrond defaults


edit the /var/www/fcgi/master/php5/php.ini
add ":/var/www/virtual/" to open_basedir

edit the /etc/apache2/sites-available/00_master.conf
add ":/var/www/virtual/" to php_admin_value open_basedir

edit the /etc/ispcp/apache/00_master.conf
add ":{APACHE_WWW_DIR}" to php_admin_value open_basedir

restart apache

copy the provided gui folder gui to /var/www/ispcp/gui/

add a second grop to user vu2000 "vu master"
usermod -G www-data vu2000 "attention, the G must be uppercase"

set the original permission to the engine and gui folder

cd /var/www/ispcp/engine/setup/
./set-engine-permissions.sh
./set-gui-permissions.sh

restart ispcp_daemon
restart ispcp_network
restart hcrond
restart apache

Have fun!

xtc007
RTMedia.ca

.zip  ispcp_cronjobs_by_xtc007.zip (Size: 122.63 KB / Downloads: 88)
12-31-2009 02:41 PM
Find all posts by this user
koko92_national Offline
Junior Member
*

Posts: 70
Joined: Jul 2008
Reputation: 0
Post: #2
RE: [HowTO] add cronjob on Debian Lenny Improved
Works great! But when you edit a cron job the time selected when adding is not selected if you understand me. Otherwise its great.
12-31-2009 09:49 PM
Find all posts by this user
xtc007 Offline
Junior Member
*

Posts: 26
Joined: Dec 2009
Reputation: 0
Post: #3
RE: [HowTO] add cronjob on Debian Lenny Improved
Yes, i know...

two improvement are to be made

when no cronjob, no reason to have edit and delete button
and the time not selected

i will work on it, but for a howto 1.0 version, i'm pretty happy by the result
be assured the version 1.1 will be better... i will inform you when released if you want...

xtc007
RTMedia.ca
12-31-2009 10:13 PM
Find all posts by this user
koko92_national Offline
Junior Member
*

Posts: 70
Joined: Jul 2008
Reputation: 0
Post: #4
RE: [HowTO] add cronjob on Debian Lenny Improved
Ok i have made modifications for the "edit & delete" when no cron jobs:

Open cronjob_overview.php and replace with:
PHP Code:
<?php
/*
* (с) 2009, Russia, Moscow
* Serge Obookhoff AKA Hong Lee
* www.data-stream.ru && www.veterinars.ru
* Last Revision at 01/2009
*     Written for ispCP Team (www.isp-control.net) ONLY.
*     Written using the old, dead blanks VHCS.
* All Functions rewritten.
*
* Notice: If you use this script you have own risks.
*
*
* Modified on 29-12-2009 by xtc007
* Functionality added : fixed white square display in top on 1.0.3
* RT Media Inc ~ www.rtmedia.ca

*/

require '../include/ispcp-lib.php';

check_login(__FILE__);

$tpl = new pTemplate();
$tpl->define_dynamic('page'Config::get('CLIENT_TEMPLATE_PATH') . '/cronjobs_overview.tpl');
$tpl->define_dynamic('page_message''page');
$tpl->define_dynamic('logged_from''page');
$tpl->define_dynamic('cronjobs''page');

$theme_color Config::get('USER_INITIAL_THEME');

$tpl->assign(
    array(
'TR_CLIENT_CRONJOBS_TITLE' => tr('ispCP - Client/Cronjob Manager'),
        
'THEME_COLOR_PATH' => "../themes/$theme_color",
        
'THEME_CHARSET' => tr('encoding'),
        
'ISP_LOGO' => get_logo($_SESSION['user_id'])
        )
    );

# Getting user's right to reading and using  the Jobs





function gen_cron_user(&$tpl, &$sql$domain) {

}

function 
gen_cron_jobs(&$tpl, &$sql$user_id) {

    
$query = <<<SQL_QUERY
        SELECT
            id, name, lastrun, activ, coment, domain
        FROM
            hcrondtab
        WHERE
            domain = 
$user_id
        ORDER BY
            id
SQL_QUERY;

    
$rs exec_query($sql$query, array($user_id));

    if (
$rs->RecordCount() == 0) {
        
$tpl->assign(
            array(
'NAME' => tr('Jobs list is empty!'),
                
'DESCRIPTION' => '',
                
'ACTIVE' => '',
                
'LASTRUN' => '',
                
'EDIT' => '',
                
'DELETE' => ''
                
)
            );

    } else {

        
$counter 0;
        while (!
$rs->EOF) {
            if (
$counter == 0) {
                
$tpl->assign('ITEM_CLASS''content');
            } else {
                
$tpl->assign('ITEM_CLASS''content2');
            }

            if (
$rs->fields['activ'] == 1) {$activ 'Yes';}
            else {
$activ 'No';};
            
$lastrun $rs->fields['lastrun'];
            if (
$lastrun == ) {$lastrun '';}
                else {
$lastrun date("Y-m-d H:i:s",$lastrun);}
            
$tpl->assign(
                array(
'NAME' => $rs->fields['name'],
                    
'DESCRIPTION' => $rs->fields['coment'],
                    
'LASTRUN' => $lastrun,
                    
'ACTIVE' => $activ,
                    
'ID'  => $rs->fields['id'],
                    
'EDIT' => '<img src="{THEME_COLOR_PATH}/images/icons/edit.png" width="16" height="16" align="absmiddle"> <a href="cronjobs_edit.php?cron_id={ID}" class="link">{TR_EDIT}</a>',
                    
'DELETE' => '<img src="{THEME_COLOR_PATH}/images/icons/delete.png" width="16" height="16" border="0" align="absmiddle"> <a href="#" class="link" onclick="action_delete(\'cronjobs_delete.php?cron_id={ID}\', \'{NAME}\')">{TR_DELETE}</a>'
                    
)
                );
            
$tpl->parse('CRONJOBS''.cronjobs');
            
$rs->MoveNext();
            
$counter++;
        }

    }

// End of gen_cron_job();

/*
 *
 * static page messages.
 *
 */

gen_client_mainmenu($tplConfig::get('CLIENT_TEMPLATE_PATH') . '/main_menu_webtools.tpl');
gen_client_menu($tplConfig::get('CLIENT_TEMPLATE_PATH') . '/menu_webtools.tpl');

gen_logged_from($tpl);

check_permissions($tpl);

gen_cron_jobs($tpl$sql$_SESSION['user_id']);

$tpl->assign(
    array(
'TR_CRON_MANAGER' => tr('Cronjob Manager'),
        
'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s?'true'%s'),
        
'TR_CRONJOBS' => tr('Cronjobs'),
        
'TR_ACTIVE' => tr('Active'),
        
'TR_ACTION' => tr('Active'),
        
'TR_EDIT' => tr('Edit'),
        
'TR_DELETE' => tr('Delete'),
        
'TR_ADD' => tr('Add Cronjob')
        )
    );

gen_page_message($tpl);

$tpl->parse('PAGE''page');
$tpl->prnt();

if (
Config::get('DUMP_GUI_DEBUG'))
    
dump_gui_debug();

unset_messages();

?>

Open cronjobs_overview.tpl and replace with:
PHP Code:
<html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset={THEME_CHARSET}">
<
title>{TR_CLIENT_CRONJOBS_TITLE}</title>
  <
meta name="robots" content="noindex">
  <
meta name="robots" content="nofollow">
<
link href="{THEME_COLOR_PATH}/css/ispcp.css" rel="stylesheet" type="text/css">
<
script type="text/javascript" src="{THEME_COLOR_PATH}/css/ispcp.js"></script>
<script type="text/javascript">
<!--
function action_delete(url, name) {
    if (!confirm(sprintf("{TR_MESSAGE_DELETE}", name)))
        return false;
    location = url;
}
//-->
</script>
</head>

<body onload="MM_preloadImages('{THEME_COLOR_PATH}/images/icons/database_a.gif','{THEME_COLOR_PATH}/images/icons/domains_a.gif','{THEME_COLOR_PATH}/images/icons/ftp_a.gif','{THEME_COLOR_PATH}/images/icons/general_a.gif' ,'{THEME_COLOR_PATH}/images/icons/email_a.gif','{THEME_COLOR_PATH}/images/icons/webtools_a.gif','{THEME_COLOR_PATH}/images/icons/statistics_a.gif','{THEME_COLOR_PATH}/images/icons/support_a.gif')">
<!-- BDP: logged_from --><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20" nowrap="nowrap" class="backButton">&nbsp;&nbsp;&nbsp;<a href="change_user_interface.php?action=go_back"><img src="{THEME_COLOR_PATH}/images/icons/close_interface.png" width="16" height="16" border="0" align="absmiddle"></a> {YOU_ARE_LOGGED_AS}</td>
      </tr>
    </table>
    <!-- EDP: logged_from -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" style="border-collapse: collapse;padding:0;margin:0;">
<tr>
<td align="left" valign="top" style="vertical-align: top; width: 195px; height: 56px;"><img src="{THEME_COLOR_PATH}/images/top/top_left.jpg" border="0"></td>
<td style="height: 56px; width:100%; background-color: #0f0f0f"><img src="{THEME_COLOR_PATH}/images/top/top_left_bg.jpg" width="582"border="0"></td>
<td style="width: 73px; height: 56px;"><img src="{THEME_COLOR_PATH}/images/top/top_right.jpg" border="0"></td>
</tr>
    <tr>
        <td style="width: 195px; vertical-align: top;">{MENU}</td>
        <td colspan="2" style="vertical-align: top;"><table style="width: 100%; border-collapse: collapse;padding:0;margin:0;">
          <tr height="95">
            <td style="padding-left:30px; width: 100%; background-image: url({THEME_COLOR_PATH}/images/top/middle_bg.jpg);">{MAIN_MENU}</td>
            <td style="padding:0;margin:0;text-align: right; width: 73px;vertical-align: top;"><img src="{THEME_COLOR_PATH}/images/top/middle_right.jpg" border="0"></td>
          </tr>
          <tr>
            <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left"><table width="100%" cellpadding="5" cellspacing="5">
                    <tr>
                      <td width="25"><img src="{THEME_COLOR_PATH}/images/content/table_icon_tools.png" width="25" height="25"></td>
                      <td colspan="2" class="title">{TR_CRON_MANAGER}</td>
                    </tr>
                </table></td>
                <td width="27" align="right">&nbsp;</td>
              </tr>
              <tr>
                <td><table width="100%" cellpadding="5" cellspacing="5">
                    <!-- BDP: page_message -->
                    <tr>
                      <td width="25">&nbsp;</td>
                      <td colspan="3" class="title"><span class="message">{MESSAGE}</span></td>
                    </tr>
                    <!-- EDP: page_message -->
                    <tr>
                      <td width="25">&nbsp;</td>
                      <td class="content3"><strong>{TR_CRONJOBS}</strong></td>
                      <td align="center" class="content3"><strong>{TR_ACTIVE}</strong></td>
                      <td align="center" class="content3"><strong>Last Run</strong></td>
                      <td colspan="2" align="center" class="content3"><strong>{TR_ACTION}</strong></td>
                    </tr>
                    
                      <!-- BDP: cronjobs -->
            <tr>
                      <td nowrap="nowrap">&nbsp;</td>
                      <td nowrap="nowrap" class="{ITEM_CLASS}"><strong>{NAME}</strong><br>
                        {DESCRIPTION}</td>
                      <td width="100" align="center" nowrap="nowrap" class="{ITEM_CLASS}">{ACTIVE}</td>
                      <td width="150" align="center" nowrap="nowrap" class="{ITEM_CLASS}">{LASTRUN}</td>
                      <td width="100" nowrap="nowrap" class="{ITEM_CLASS}">{EDIT}</td>
                      <td width="100" nowrap="nowrap" class="{ITEM_CLASS}">{DELETE}</td>
                    </tr>
                      <!-- EDP: cronjobs -->
                    <tr>
                      <td nowrap="nowrap">&nbsp;</td>
                      <td colspan="4"><input name="button" type="button" class="button" onclick="MM_goToURL('parent','cronjobs_add.php');return document.MM_returnValue" value="{TR_ADD}"></td>
                    </tr>
                </table></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
    </tr>
</table>
</body>
</html> 
12-31-2009 10:47 PM
Find all posts by this user
Kika Offline
Member
***

Posts: 293
Joined: Feb 2007
Reputation: 8
Post: #5
RE: [HowTO] add cronjob on Debian Lenny Improved
Merci Smile
01-03-2010 01:55 AM
Find all posts by this user
xtc007 Offline
Junior Member
*

Posts: 26
Joined: Dec 2009
Reputation: 0
Post: #6
RE: [HowTO] add cronjob on Debian Lenny Improved
De rien,

Je travail sur les 2 petites améliorations citée plus haut, et vous en informerais lorsque disponible!

Bonne Journée

xtc007
RTMedia.ca
01-03-2010 02:58 AM
Find all posts by this user
MasterTH Offline
Member
***

Posts: 570
Joined: Feb 2009
Reputation: 4
Post: #7
RE: [HowTO] add cronjob on Debian Lenny Improved
Hi guys,

thanks a lot for this howto and the improvement
After adding this i get an error when i try to geht into the menu CronJobs:

"HY093"


So somebody knows where the problem is?
01-03-2010 05:16 AM
Find all posts by this user
xtc007 Offline
Junior Member
*

Posts: 26
Joined: Dec 2009
Reputation: 0
Post: #8
RE: [HowTO] add cronjob on Debian Lenny Improved
i don't have try the mod of koko92_national at this time...

are you using the files in the zip file...

what your ispcp version, and what's the error exactly?

are you able to send a print screen?

xtc007
RTMedia.ca
01-03-2010 05:20 AM
Find all posts by this user
koko92_national Offline
Junior Member
*

Posts: 70
Joined: Jul 2008
Reputation: 0
Post: #9
RE: [HowTO] add cronjob on Debian Lenny Improved
I think this is an SQL error. Look at the config file and see if you have entered the correct info for the database.
01-03-2010 06:16 AM
Find all posts by this user
MasterTH Offline
Member
***

Posts: 570
Joined: Feb 2009
Reputation: 4
Post: #10
RE: [HowTO] add cronjob on Debian Lenny Improved
Array
File: /var/www/ispcp/gui/client/cronjobs_overview.php (Line: 63) Function: exec_query
File: /var/www/ispcp/gui/client/cronjobs_overview.php (Line: 123) Function: gen_cron_jobs


I get this email from the ispcp daemon.

The databasesettings are correct.
server: localhost:
Port: 3306
Database: ispcp
table : hcrondtab

as connectionuser i used the root-user but this shouldnt be the problem
01-03-2010 06:24 AM
Find all posts by this user
Thread Closed 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)