# PBM backup automation

**URL:** <https://forums.percona.com/t/pbm-backup-automation/15569>\
**Category:** Percona Backup for MongoDB\
**Tags:** percona, mongodb\
**Created:** [May 5, 2022, 3:10pm UTC](https://forums.percona.com/t/pbm-backup-automation/15569 "2022-05-05T15:10:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aranjith0](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/aranjith0/32/13012_2.png) [@aranjith0](https://forums.percona.com/u/aranjith0)\
**Post date:** [May 5, 2022, 3:10pm UTC](https://forums.percona.com/t/pbm-backup-automation/15569/1 "2022-05-05T15:10:49Z")

</div>

Hello,  
I have a requirement to automate Percona backup for mongoDB (PBM) scheduled via crontab.(Shell scripting)

Please provide any reference scripts which runs “pbm backup” automatically without manual intervention.

Planning to automate below actions through scripts:

1. pbm backup
2. PITR
3. pbm restore.

any help is appreciated.

---

<div class="post-metadata">

**Author:** ![aranjith0](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/aranjith0/32/13012_2.png) [@aranjith0](https://forums.percona.com/u/aranjith0)\
**Post date:** [May 6, 2022, 1:52pm UTC](https://forums.percona.com/t/pbm-backup-automation/15569/2 "2022-05-06T13:52:02Z")

</div>

How the pbm rrestore can be automated?

pbm restore . have to get backupfilename from the list using ‘pbm list’  
then have to pass the filename to the command - “pbm restore \<\>”

is it possible to accomplish through shell script?

---

<div class="post-metadata">

**Author:** ![Evgeniy\_Patlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/evgeniy_patlan/32/41_2.png) [@Evgeniy\_Patlan](https://forums.percona.com/u/Evgeniy_Patlan)\
**Post date:** [May 9, 2022, 9:45am UTC](https://forums.percona.com/t/pbm-backup-automation/15569/3 "2022-05-09T09:45:20Z")

</div>

@aranjith0 well you should automatically detect what backup you want to use for restoration and pass it to PBM

---

<div class="post-metadata">

**Author:** ![Evgeniy\_Patlan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/evgeniy_patlan/32/41_2.png) [@Evgeniy\_Patlan](https://forums.percona.com/u/Evgeniy_Patlan)\
**Post date:** [May 9, 2022, 9:53am UTC](https://forums.percona.com/t/pbm-backup-automation/15569/5 "2022-05-09T09:53:13Z")

</div>

@aranjith0 well you should do this by your own as I don’t know the logic which you need to use to select the appropriate backup and any other details.

---

<div class="post-metadata">

**Author:** ![aranjith0](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/aranjith0/32/13012_2.png) [@aranjith0](https://forums.percona.com/u/aranjith0)\
**Post date:** [May 16, 2022, 10:16am UTC](https://forums.percona.com/t/pbm-backup-automation/15569/6 "2022-05-16T10:16:57Z")

</div>

Please provide any reference scripts which runs “pbm backup” automatically though shell scripts.
