• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved Migrator : Failed to copy mail content of subscription in Cron Job.

Teny

New Pleskian
Hi all,

I use plesk migrator in Command Line.
I've made a little .sh script that do several plesk migrator job and everything just work as expected when I start the script in terminal ssh window.
But when I call the script in a cron job (also as a root user) everything is ok BUT the mail transfert. Here is the detailed log :

[pre]
# Failed to copy mail content of subscription. Most probably that happens because of a network-related issue. Please check network connections between source and target servers, then re-copy mail content with the help of 'copy-mail-content' command
# Migration tools tried to perform operation in 3 attempts: Command execution failed on the local server with non-zero exit code.
# command: plesk bin mail --recalculate-mailboxes-usage [domain]
# exit code: 127
# stdout:
# stderr: /bin/sh: 1: plesk: not found
[/pre]

It's very frustrating since it works when I Call the script manually.
Is there any issue I've missed so far ?

Thanks for all the answers.

Ten

Edit : Sorry for the english mistakes since it's not my birth language.
 
Last edited:
Can you explain more about what this script is suppose to be doing? Maybe we can come up with a different solution.

I don't see why you would need any sort of migration script running on a cron....
 
Hi Mark,

thanks for the quick reply.

My script is used to "mirror" some websites (taking place on server A, server B, ... etc) on another server (server Z).

Here is what I've done :
- I've made a migration of serveral websites on a dedicated server with failover IPs in order to quickly switch between 2 servers in case of trouble.
- I run each days a plesk-migrator command with the copy-content action in order to synchronise contents (httpdocs files, mail, etc...) so the mirroring is "up to date".

Each command for one domain looks like this one :
/opt/psa/admin/sbin/modules/panel-migrator/plesk-migrator copy-content /[PATH-TO-INI-FILE]/config.ini --migration-list-file=/[PATH-TO-JSON-FILE]/subscription-list.json --skip-services-checks --skip-license-checks --ignore-migration-list-errors --migration-list-format=json

Each command take place in a script.sh file (#!/bin/sh)

And it works like a charm when I execute the script as a ssh root user!
BUT
when executed as a cron job the mail copy fail with the error described before.

Weird isn't it ?

Thanks.
 
So it sounds like you are using a tool for migrations but as a way to backup? I get what you're trying to do, but once it's synced it's going to be outdated again till the next run.

I think you would be better off using virtualization - you can backup or clone easily, and they can even be kept on a second hardware node.
 
I'm afraid you're right Mr Muyskens,

It's true that it's not the "has-to-be" way of backuping websites.
But to tell the truth I'm not very comfortable with virtualization between servers and the plesk backup tool doesn't fit my needs...
The idea of using the plesk migrator tool to sync content now is the best compromise I've found so far.

But about my first question, have you any clue or direction I can follow ?
I will obviously continue invertigating on my side but if you already encounter this issue, may be you would agree to share it with me ?

Thanks again.

Ten
 
This is because crontab does not use system variables like PATH. You can find more details in the crontab(5) man page.
 
Mr.D,

thanks again for your answer : that did the trick !
Shame on me I didn't see it before but that's also why forums exist

It was indeed a PATH problem :
it seems that plesk migrator was looking for the "plesk" command for mail dealing stuff (in plesk bin mail --recalculate-mailboxes-usage [domain]).

I just added this on top of my cron script :
PATH=$PATH:/usr/sbin
export PATH


Best regards,

Teny
 
Hi Mark,

thanks for the quick reply.

My script is used to "mirror" some websites (taking place on server A, server B, ... etc) on another server (server Z).

Here is what I've done :
- I've made a migration of serveral websites on a dedicated server with failover IPs in order to quickly switch between 2 servers in case of trouble.
- I run each days a plesk-migrator command with the copy-content action in order to synchronise contents (httpdocs files, mail, etc...) so the mirroring is "up to date".

Each command for one domain looks like this one :
/opt/psa/admin/sbin/modules/panel-migrator/plesk-migrator copy-content /[PATH-TO-INI-FILE]/config.ini --migration-list-file=/[PATH-TO-JSON-FILE]/subscription-list.json --skip-services-checks --skip-license-checks --ignore-migration-list-errors --migration-list-format=json

Each command take place in a script.sh file (#!/bin/sh)

And it works like a charm when I execute the script as a ssh root user!
BUT
when executed as a cron job the mail copy fail with the error described before.

Weird isn't it ?

Thanks.
Hello Teny, could I contact you directly ? I've been trying to do exactly like you (using a cronjob to run Plesk migrator daily between 2 servers) but I can't seem to make it. Would you share your script ?

Thanks
Pierre
 
Back
Top