Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM Backup Notifications

Avatar

Community Advisor

Hi,

I need to automate the backup of AEM via cron job and on completion of backup, it should send a email stating "Backup has been complete". And, in case, somebody cancelled the backup, it should send messages like "Backup Cancelled".

 

AEM backup automation via cron job is done. Part that is left is, how to get to know if backup still in progress, completed or cancelled and send these messages via email.

Is it possible to do that?

 

Regards,

Himanshu

3 Replies

Avatar

Community Advisor

Hi Himanshu,

I dont think there are any events that can give the status. Only option I could think of is, parsing the logs we may be able to get it.

Avatar

Community Advisor

And, is there anyway, we can trigger email service via script only to send logs messages?

Avatar

Level 7

Hi,

As Lokesh said there are no events that can give the status.

But you can trigger trigger a servlet via script (I take that you are referring to javascript). And from that servlet you could easily trigger mail.

 

Thanks

Tuhin

Avatar

Employee

Hi Himanshu,

have you explored using a JMX call to determine the status of a backup? [0] On the Repository MBean there is a property BackupInProgress

I haven't done what you are trying to do myself, but so best to explore. Are you triggering the backup using a curl command? [1]

Here is a script [2] you could modify or use?

Regards,

Opkar

[0] https://docs.adobe.com/docs/en/aem/6-2/administer/operations/jmx-console.html

[1] http://www.aemcq5tutorials.com/tutorials/adobe-cq5-aem-curl-commands/

[2] http://cq-ops.tumblr.com/post/55788957329/shell-script-for-cq-backup

Avatar

Level 2

When the backup starts, AEM creates an empty file backupInProgress.txt at the root of the backup directory and removes it when the backup is complete. The presence of this file indicate backup is in progress and its absence indicate backup has been completed. 

You could use this for your scripting.

Avatar

Community Advisor

But, if we cancel the backup, in that case also, backprogress file is gone, Then, how to find out if backup completed or cancelled?

Avatar

Community Advisor

I tried to capture jmx console using curl command and stored output in a file and from there checked the status of backup.

It works file. 🙂

Commands:

curl -u admin:admin http://localhost:4502/system/console/jmx/com.adobe.granite%3Atype%3DRepository > $LOG_FILE_STATUS if  grep -q -i 'Backup canceled' $LOG_FILE_STATUS

Avatar

Level 2

Hi Himanshu,

How do you cancel online backup if you are backing up to certain folder? With backing up to zip file, we can see the process via UI and can cancel it right away.