server-gurus / RCimapSync

Roundcube IMAPSYNC Plugin
4 stars 5 forks source link

Can't run imapsync.pl #3

Closed eRJx closed 7 years ago

eRJx commented 7 years ago

cron job in /etc/crontab */5 * * * * root /var/lib/roundcube/plugins/imapsync/bin/imapsync.pl

not working and imap folders are not synchronized. When I ran imapsync.pl from console with folder /var/lib/roundcube/plugins/imapsync/bin/ I get error:

'db_conf' is not a valid variable name at config.conf line 3. BEGIN failed--compilation aborted at config.conf line 3. Compilation failed in require at ./imapsync.pl line 15. WARNING: releasing 1 pending lock...

DaCHRIS commented 7 years ago

I am not our Perl dev. So only chrisno can clear this completely.

As a quick workaround you can copy only the lines with real variables from the config.conf to imapsync.pl, commenting out the 'use' and 'require' lines.

Perhaps this works until our dev could see what's the real problem.

Regards

Chris

eRJx commented 7 years ago

I modified imapsync.pl :

`#!/usr/bin/perl

use strict; use DBI; use MIME::Base64; use Sys::Syslog; use LockFile::Simple qw(lock trylock unlock);

use vars qw/ %db_conf /;

$Conf::db_conf{'host'} = "127.0.0.1"; $Conf::db_conf{'db'} = "roundcubemail"; $Conf::db_conf{'username'} = "imapsync"; $Conf::db_conf{'password'} = "onepassword";

my $lock_file = "/var/run/imapsync/imapsync-all.lock"; my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1); $lockmgr->lock($lock_file) || &log_and_die("can't lock ${lock_file}");

require "config.conf" || log_and_die($!);

`and it working with console and corn. Original version imapsync.pl still not working.

Thans for your advice

Roman

chr1sn0 commented 7 years ago

Hi Roman,

first of all, try this in your crontab:

*/5 * * * * root cd /var/lib/roundcube/plugins/imapsync/bin/ && perl imapsync.pl >/dev/null 2>&1

Greetz chr1sn0

eRJx commented 7 years ago

Hi chr1sn0 I tired and it not working. I tired lunch: perl imapsync.pl in console and I get same error:

'db_conf' is not a valid variable name at config.conf line 3.
BEGIN failed--compilation aborted at config.conf line 3.
Compilation failed in require at ./imapsync.pl line 20.
WARNING: releasing 1 pending lock...
chr1sn0 commented 7 years ago

Hi,

post ure config.conf pls (without PWD)

Greetz

eRJx commented 7 years ago

package Conf;

use vars qw/ db_conf /;

$db_conf{'host'} = "127.0.0.1"; $db_conf{'db'} = "roundcubemail"; $db_conf{'username'} = "imapsync"; $db_conf{'password'} = "**";

1;

chr1sn0 commented 7 years ago

you missed a '%' in Line 3.

Correct:

use vars qw/ %db_conf /;

fixed it in our sample.

Greetz

eRJx commented 7 years ago

Hi After your adjustment it work.

Greetz