FORUMS

[GUIDE][Difficulty: Intermediate] Weekly TWRP Backups

932 posts
Thanks Meter: 2,019
 
Post Reply Email Thread
29th March 2018, 04:57 PM |#101  
Senior Member
Thanks Meter: 27
 
More
Quote:
Originally Posted by brad2192

If you're having issues saving your backup to your SD card replace this:

Code:
chmod 0777 /cache/recovery
echo "wipe cache\nwipe dalvik\nbackup SDBOM weeklybackup \ncmd reboot" > /cache/recovery/openrecoveryscript
with:

Code:
chmod 0777 /cache/recovery

echo "set tw_storage_path /external_sd"

echo "backup SDBOM weeklybackup \ncmd reboot" > /cache/recovery/openrecoveryscript

Tried this but still no success Since the update to android 8.1 my nandroid backup gets saved to internal storage.
30th March 2018, 10:45 AM |#102  
Senior Member
Thanks Meter: 437
 
More
Quote:
Originally Posted by trohn_javolta

Tried this but still no success Since the update to android 8.1 my nandroid backup gets saved to internal storage.

If you do normal backup in TWRP, where did it go? I already set the default backup to microsd, and I don't change the name of the backup either. I simply use
Code:
chmod 0777 /cache/recovery
echo "backup SDO\ncmd reboot" > /cache/recovery/openrecoveryscript reboot recovery
This will make the backup to microsd, compressed, md5 checked and the name based on the date (default). Later I add additional flow to check the size of the backup and give me choice to delete all backups except the last two. Added also additional check if the battery is less than 50%, the backup will be cancelled and inform me. I also record the time, battery level, temp and etc; so after finished backup, it will inform me about how long did the backup take, draining how much battery percentage, increase in temperature and etc.
30th March 2018, 11:03 AM |#103  
Senior Member
Thanks Meter: 27
 
More
Quote:
Originally Posted by Desmanto

If you do normal backup in TWRP, where did it go? I already set the default backup to microsd, and I don't change the name of the backup either. I simply use

Code:
chmod 0777 /cache/recovery
echo "backup SDO\ncmd reboot" > /cache/recovery/openrecoveryscript reboot recovery
This will make the backup to microsd, compressed, md5 checked and the name based on the date (default). Later I add additional flow to check the size of the backup and give me choice to delete all backups except the last two. Added also additional check if the battery is less than 50%, the backup will be cancelled and inform me. I also record the time, battery level, temp and etc; so after finished backup, it will inform me about how long did the backup take, draining how much battery percentage, increase in temperature and etc.

Omg...indeed. Did an update of twrp and the standard backup path was set to internal storage Thx man.

I'd also be interested in how I can automatically delete a backup..like the 3rd last to only keep last 2 backups. How do you do that?
I guess I don't need all the additional stuff you have going on. I set my backup to kick in only if the phone is charging and it is 4 am. But until now before a new backup, tasker deletes the old one...which isn't ideal at all.
Does the \ncmd add date and time? I'd only need date + a name of my choosing. Is that possible?
30th March 2018, 01:34 PM |#104  
Senior Member
Thanks Meter: 437
 
More
Quote:
Originally Posted by trohn_javolta

Omg...indeed. Did an update of twrp and the standard backup path was set to internal storage Thx man.

I'd also be interested in how I can automatically delete a backup..like the 3rd last to only keep last 2 backups. How do you do that?
I guess I don't need all the additional stuff you have going on. I set my backup to kick in only if the phone is charging and it is 4 am. But until now before a new backup, tasker deletes the old one...which isn't ideal at all.
Does the \ncmd add date and time? I'd only need date + a name of my choosing. Is that possible?

Glad you solved it.

For checking last backup folder, you can use List Files and point to your TWRP directory, sort by Modification Date. The result variable will be in array, example %twrp. You can count how many folders there, and loop against it to delete except the last 2. Counting array, by using %twrp(#). If this is bigger than 2, then delete the rest except the last 2. Each of the folder name can be accessed using the array number, %twpr1 will be the first folder and etc. Can't show you this part, as I am creating it in automagic, not in tasker. I use regex and input dialog to make the deletion semi automatically (because I don't want to mis-deleted the manual backup). Recreating it in tasker is too awkward for me now. I only use the command script from here.

To change the backup name, you can add the name + date (last%DATE) inside the script.
Code:
chmod 0777 /cache/recovery
echo "backup SDBOM last%DATE \ncmd reboot" > /cache/recovery/openrecoveryscript
Should give you the backup name as last3-30-2018
28th September 2018, 03:57 PM |#105  
Junior Member
Thanks Meter: 5
 
More
I've tried this, however TWRP seems to not be executing the openrecoveryscript file.

I modified the Task to be one line "Run Shell"

Code:
chmod 0777 /cache/recovery
echo "backup SDCRBM weeklybackup" > /cache/recovery/openrecoveryscript
echo "reboot" >> /cache/recovery/openrecoveryscript
chmod 777 /cache/recovery/openrecoveryscript
I even added the chmod 777 to make sure that I'm not running into permission problems when TWRP tries to use the file.
I verified that tasker is writing to /cache/recovery by running in Termux:

Code:
cat  /cache/recovery/openrecoveryscript
which returns:
Code:
backup SDCRBM weeklybackup
reboot
I'm at a loss. I feel like I'm missing one silly little detail. Any help would be appreciated.

LineageOS 16.0 unofficial / TWRP 3.2.3 on Samsung Galaxy S7
3rd February 2020, 07:25 PM |#106  
Member
Thanks Meter: 11
 
Donate to Me
More
Quote:
Originally Posted by epicurean

Is there a way to unlock encryption for the phone before or after the phone boots into recovery to do the backup?

Right now it cant execute the script unless I unlock the finger pattern


I am wondering the same thing. I have googled around and tried to add decrypt "mypincode" as the first line in the openrecoveryscript file. But it seem like twrp is not running the openrecoveryscript until after I have manually inputed the pincode on screen or through the adb twrp decrypt command.
Also have a oneplus 5.
Post Reply Subscribe to Thread

Tags
backup, tasker, twrp, weekly

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes