yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] voroxda:
No, I was running the original script, only with the adapted sd card location. The backup itself runs without problems. TWRP detected the commandline

»backup SDCB«

The selected partitions were backupd in the correct location.

Everything was fine. Also later with a started System partition the Nandroid Manager detects the backup as a valid.

Sorry to say, the script is only the overhead (of cause well programmed). What is important for the command line interface?

It must exist a file in /cache/recovery

named openrecoveryscript, which is readable (0777)

and contains a valid command like: backup SDCB

And then you could reboot to recovery.

Not more, not less. The problem is when TWRP starts again to reboot to system. There must remain TWRP based configuration files. For example. TWRP doesn't need big cores. So is my explanation of the core setup after restarting +see screenshot+

May be for kantjer interesting here my environment:

Samsung Galaxy S8+ SM-G955f

OS Oreo

ROM Ambasadii Odexed Rom 3.6

Kernel: DJ Max 2.0c

Rooting solution: Magisk 16.4/17.1

TWRP 3.2.1-0
[Android Apps and Games] kantjer:
It's impossible for the openrecovery script to change ant CPU settings.

What I think happened it that the big core where disable due to thermal threshold kicking in.

Making a backup takes a lot of cpu power, specially when you compress the file.

When the CPU gets hot the big cores are disabled, for me on my Nexus 6P this happens a lot when flashing a ROM in summer period.

The big cores come back online when the cpu cools off, on my phone that usually takes up to 5 minutes after booting .
[Android Apps and Games] voroxda:
Thank you, that explains the disabled big cores and underclocked little cores, but the problem was the bootloop !!!!
[Android Apps and Games] kantjer:
I have no idea how making a backup can cause a bootloop.

In the years I use the script I think I have seen that happen 2 times. In both cases a forced reboot fixed it.
[Android Apps and Games] kantjer:
Check this out: https://play.google.com/store/apps/details?id=com.victorlapin.flasher

This makes my Tasker script obsolete.

I have been testing this beauty for the last 2 months and it's everything my script did and much more.

Rock solid app.
[Android Apps and Games] letmedanz:
Thanks B!

Your scripts ran so well, never bothered trying anything else.

Just installed the app and will try it for a few. Am sure Victor's done a fabulous job with it.

I don't think there is an option to check and delete backups though right? Or am I blind?

PS: Hope you are doing well! It's been ages. Best wishes to you and the Mrs :)
[Android Apps and Games] kantjer:
Hi P,

Nice to hear from you again, hope all is well with you and the family.

I'm doing better after last years health troubles.

The app does have an option to delete old backups, check the settings.
[Android Apps and Games] shibadoo:
Hi there,

I've only just discovered Tasker_Nandroid. I downloaded it from http://www.mediafire.com/download/hn3hpc81xb8eu02/NANDroidTasker.zip because the links in your first post do not work anymore. I did the import into latest version of tasker. Then I started manually the task "TWRP backup" without changing anything. The tasks starts and I see green dots until "8. Stopp". Then the task obviously stops. In "7. Goto" there is a small red vertical line on the right side near "%BU_TIME ..." (in VAR I can see that BU_TIME is set). In "8. Stopp" there is a small green vertical line in the right side. I am not asked for superuser permission (phone is rooted).

What is going wrong here? Do I have to change something? in the meantime I assigned superuser permission to Tasker manually, but this did not help. It always stops after "8". I would be grateful for any help as I just lost all my data during a failed OTA update and my last backup was like 18 months old...
[Android Apps and Games] shibadoo:
Weird.... I changed Tasker language to English, and now it works...
[Android Apps and Games] hyborian:
Can this backup System-Image and Vendor-Image ?
[Android Apps and Games] varunpilankar:
How can we use this task on encrypted phone?

Task runs and get stuck on TWRP password screen.
[Android Apps and Games] eried1:
Any updated method for 2023?
[Android Apps and Games] kantjer:
there are plenty solutions for that.

I'm using Folder sync in combination with Tasker, but you can also use Dropsync .
[Android Apps and Games] NovaSlim:
Is this just me or does this script fail more often now? Since 09/21 I haven't had a backup made automatically. The last two nights all the script did was boot into TWRP home page and stay there.

Only change I made since 09/21 is flash slimgapp with the latest google search.
[Android Apps and Games] kantjer:
I'm still using the script and it never failed me.
[Android Apps and Games] NovaSlim:
interesting, I have had a couple times where the script failed to reboot..

Edit: figured out why, after downloading a couple of audiobooks I no longer have enough free space and that caused the TWRP to malfunction. After deleteing a few audiobooks the script now runs fine.
[Android Apps and Games] VampiruX:
Sorry, error.
[Android Apps and Games] kantjer:
You can also run the retention script with number of backups to keep-1 before starting a new nandroid. If you want to keep more than one backup it's safe to do so. I haven't set that in the task because is a user only wants to keep one backup and thats removed before making a new one you end up without a backup if the backup fails. It never happened to me but potentially it would be a risk.

#whiteuimustdie
[Android Apps and Games] SJMarty:
This is great stuff. It looks like the documentation link for the OpenRecoveryScript has moved. Is there a new location available?
[Android Apps and Games] vagaBond07:
[MENTION=3306843]kantjer[/MENTION] Is there a way mate to route the Nand Backup to SD? I tried changing manually in recovery but got an error when running a test.
[Android Apps and Games] kantjer:
I don't have an external sd so can't test it.

I would think that changing nadroid location in recovery would do thrick
[Android Apps and Games] kantjer:
link updated
[Android Apps and Games] Life-R:
Where I can change the path backup?
[Android Apps and Games] therahmaniac:
Reboot after backup

Hey nice work! But as I see the profile will backup in recovery and stay there.

Based on open recovery documentation a command can be executed using "cmd command". So can't a "cmd reboot" also be added to the open recovery script file after backup commands so that the phone reboots from recovery once backups are done.?
[Android Apps and Games] kantjer:
Have you tried the script?

The phone reboots back into Android after a backup for me.

#whiteuimustdie
[Android Apps and Games] LEGEND94:
Tried manually running the task

15.16.42/Variables doreplresult: |%BackUp( |%BackUp0|

15.16.42/Variables doreplresult: |%BackUp( |%BackUp0|

15.16.42/E Test File: %BU_TIME -> %BU_TIME

15.16.42/E Test File: file not found: /storage/emulated/0/%BackUp0.

Same error as http://xdaforums.com/showthread.php?p=63263921
[Android Apps and Games] therahmaniac:
My bad overthinking. Tried now and it does reboot. But am presuming that may be on some errors during backup it doesn't reboot and stays on Recovery? I tried setting the folder name for backup(A constant) and on second run it stays on recovery (doesn't show error, may be because of it being non-empty).
[Android Apps and Games] kantjer:
Uploaded new profile, the script is now also working if no previous backups are present.
[Android Apps and Games] rodrigofd:
Fix with steps failing on the copy temp file

Excellent job! Did exactly what I was looking for:

A tip from anyone who's getting errors running the actual tasks, now, which I ran into, but thanksfully solved pretty easily:

(it's probably related to a per-device thing, depending on the mounting pounts, paths, etc.)

My Tasker on a Galaxy Note 5 920i was complaining on the 'Copy file openrecoveryscript to /cache/recovery' step, and then on the delete temp file step as well.

What fixed it was to set the source filename to something more explicit, like so:

/sdcard/openrecoveryscript

on both steps, and voilá!

;)
[Android Apps and Games] Gibbothegreat:
I'm getting the following error when testing the settings : Test File: file not found:/storage/emulated/0/%BackUp0.
[Android Apps and Games] ikar:
I am trying to use your profiles, but with no success. I have a problem in the backup task. The problem appears during copying file openrecoveryscript from sd card to /cache/recovery

Here is the log

00.28.37/Shell runSync test -e '/storage/emulated/0/openrecoveryscript' root: true timeout: 3000

00.28.37/Shell have process

00.28.37/Shell write cmd: test -e '/storage/emulated/0/openrecoveryscript'

00.28.37/Shell start process timeout timer 3000ms for: test -e '/storage/emulated/0/openrecoveryscript'

00.28.37/Shell start process-thread ID 184

00.28.37/Shell joined with 184

00.28.37/Shell exit result: 0

00.28.37/Shell non-null timeout

00.28.37/Shell runSync test -f '/storage/emulated/0/openrecoveryscript' root: true timeout: 3000

00.28.37/Shell have process

00.28.37/Shell write cmd: test -f '/storage/emulated/0/openrecoveryscript'

00.28.37/Shell start process timeout timer 3000ms for: test -f '/storage/emulated/0/openrecoveryscript'

00.28.37/Shell start process-thread ID 186

00.28.37/Shell joined with 186

00.28.37/Shell exit result: 0

00.28.37/Shell non-null timeout

00.28.37/Shell runSync test -d '/storage/emulated/0/openrecoveryscript' root: true timeout: 3000

00.28.37/Shell have process

00.28.37/Shell write cmd: test -d '/storage/emulated/0/openrecoveryscript'

00.28.37/Shell start process timeout timer 3000ms for: test -d '/storage/emulated/0/openrecoveryscript'

00.28.37/Shell start process-thread ID 188

00.28.37/Shell joined with 188

00.28.37/Shell exit result: 0

00.28.37/Shell non-null timeout

00.28.37/E Copy File: /storage/emulated/0/openrecoveryscript is a directory.

I tried to change paths, but with no success. Could you give me any hint?

-------------------------------------------------------------------------------------------------------------------------------------------

It was the problem with tasker copy command . I have installed sultanxda 6.01 rooted android. I found in tasker documentation there was a problem with copy command and supersu (Root users: note that the "Mount namespace separation" option of SuperSu can cause problems.) I changed your backuptask tasker copy to shell cp , and now everything seems to be ok.

Thank you for your great job :)
[Android Apps and Games] kantjer:
Thanks for posting the fix.

if you use shell mv you can also remove the "Delete File" part

I will test and upload a new profile in a few days
[Android Apps and Games] kantjer:
you probably don't have any backups on the sd yet.

try enabling "Continue task after error" for the test file line
[Android Apps and Games] kantjer:
Updated to fix copy error on Android 6.X
[Android Apps and Games] facted:
How do I install this? Tried importing into tasker by changing filetypes but without success, and can't open the zip in any zip program Thanks!
[Android Apps and Games] kantjer:
Just unzip the task and profile zip, place them in the correct Taskers folder on your sd and import.

http://androidforums.com/threads/how-do-i-import-in-tasker.620199/
[Android Apps and Games] iPAQ 6515a User:
Hi mate. Unfortunately your prefs and tsk settings don't work on my 6.0.1 android. There is an error while deleting nand process is running (sth about file does not exist) and the nand tsk stops halfway (before restarting the phone)

Any suggestions? Btw, Open Recovery Script link is dead, would that be the reason?
[Android Apps and Games] eried1:
[MENTION=3306843]kantjer[/MENTION]

I don't understand why you choose to run the TWRP Rentention task half an hour after the TWRP Backup task? Looking at the TWRP backup it seems executes the TWRP retention task as well... I suppose it still has to something to do with limiting the number of backups, which might not work out otherwise? Could you please explain why you have two profiles set up like this?
[Android Apps and Games] kantjer:
It's executed in the backup task to set a number of variables that are needed to determine the age of the last backup.

The second time is to clean up old backup above the retention number.
[Android Apps and Games] eried1:
@ kantjer

So I could, for instance, set the retention task to run 10 minutes after the backup task? I'd like to do it this way in case I'd decide to turn off the device between 06-ish and 0630. This to make sure the second task runs everyday and isn't excluded because of the device not being on at the moment.
[Android Apps and Games] kantjer:
Sure, no problem

Sent from my Nexus 6P
[Android Apps and Games] eried1:
Great!

And one final question. Why does %TIMES-%-BU_TIME have to be less than (%BU_INT*24*3600)-(12*3600)? I don't get why you subtract by 12*3600. I assume you want the task to run the third day (if 3 is your interval) and therefore have to subtract with a number so that the profile will become active at the specified time, but I don't understand why it has been set to 12*3600 seconds.

Superb job with these profiles by the way! It's really appreciated!
[Android Apps and Games] kantjer:
subtracting 12*3600 is done to have a safety margin. If you for example set to have a build every 3 days the backup yes/no calculation is actually set to 2.5 days.

I have done that because also manually made backups are taken into account and I didn't want the interval to be too strict.
[Android Apps and Games] spraynard23:
There are problems with both zip files. I get an error when attempting to unzip them.
[Android Apps and Games] kantjer:
Uploaded the files to AFH.

See first post.

Also included a small change I made recent, if the number of nandroids to keep is >1 you can force a new nandroid at next schedule by deleting the oldest backup.
[Android Apps and Games] iluvamk:
Deleted
[Android Apps and Games] iPAQ 6515a User:
The script failed to reboot after successful backup, when testing from tasker it does work though. Any suggestions?
[Android Apps and Games] kantjer:
I don't understand the question. you say when testing from Tasker it works.

So what's the issue :confused:
[Android Apps and Games] iPAQ 6515a User:
The problem, I thought, was in the script, but no. My card started failing and sometimes it was and sometimes it was not writeable ( I have just discovered it and was about to update my post).

When there was a write error, the phone was stuck in TWRP, just like when the card is full.

Is there a way of forcing reboot no matter whether the backup was successful or not?

And a question two. I noticed the script is run everyday not every x number of days that is set in the first line of the script. Any thoughts?

Thanks in advance for your time in replying
[Android Apps and Games] zalood:
There are cases where these profiles failed to work. The problem lies in TWRP Backups path.

My device has only an internal sdcard with no external sdcard expansion option. Using explorer with root capability, the sdcard/TWRP is just look as an empty folder.

The actual backup path can be found in ROOT: /data/media/0/TWRP/BACKUPS/xxxxx/ where xxxxx is a device specific code consisting of a long series of characters.

If you tried to copy backups from the actual path to sdcard/TWRP, you'll find out that it is in fact not an empty folder.

This path need to be entered in Tasker manually or copy/paste the path to tasker, and tick Use Root option.

We can not using Tasker to search for the path as Tasker itself is not designed for root access.

There is also alternative apart from using openrecoveryscript.

Download TWRP manager from Play Store and use Tasker App Launch and AutoInput actions to run the auto back.
[Android Apps and Games] kantjer:
It could be possible that the script doesn't work in certain situation, although I haven't seen any.

That's about the only part of your post that might be true, the rest is BS.

Also it's not very respectful if somebody spends many hours something and decides to share it with the rest of the community to hijack the thread to promote other solution.
[Android Apps and Games] zalood:
Very sorry ... I didn't mean to offend any body.

Just thought that it might help those who can't run the script ...

Sorry once again .
[Android Apps and Games] rf69:
[MENTION=3306843]kantjer[/MENTION] Love it, thanks (does exactly what it should).. :cool:

I know you can add the additional folder name, but is it possible to add the folder name from a variable (let's say "Date+RomVersion")..?

Thanks in advance :)
[Android Apps and Games] kantjer:
I never looked into that.

You need to find a source were to get the Rom Version. I suspect it can be pulled from the build.prop but I'm not sure the same field is used on every ROM.

I suspect it can be done but it will mean a (partial) rewrite of the retention part off the script .

I don't see the value of doing that but feel free to give it a try.
[Android Apps and Games] rf69:
I know that i have to find the ROM Version, but it's fine because i update my ROM about once a month (CM Nightly Channel). So it's not a problem for me to change the version number every +/- 30 days in the variable.

Actually, my biggest question is if it's possible to use variables & if Tasker would actually convert those variables to text when it creates the openrecoveryscript.

I'll test it out and update my post. Thanks for your help :cool:
[Android Apps and Games] kantjer:
Did a quick test and it seems to work
[Android Apps and Games] rf69:
You are awesome, sorry i couldn't get to testing it yet.

Appreciate all your troubles :cool:
[Android Apps and Games] kantjer:
I have the script now made so it extract the build_id from the build.prop and uses that in the backup folder name.

I'm going to change a few things like setting all user setting in variables so we have them grouped together making changing them is easier and saver. Also I will add a check to make sure the folder name isn't currently used, if it is the backup will be aborted with a toast message.

I hope to have that all done in the next few days and upload a test version.
[Android Apps and Games] rf69:
That's awesome, thanks for all your work..

Can't wait for the update..

:laugh:
[Android Apps and Games] kantjer:
It's all done, Scheduled a nandroid for tomorrow morning as test
[Android Apps and Games] rf69:
Cool thanks. :cool:
[Android Apps and Games] kantjer:
You can download a test version here.

I have moved all user setting to variables at the beginning of the script.

contrary to my earlier plan I have changed the “check if backup folder exist” routine. Instead of stopping the script and flash a toast message I decided that's not very useful because the whole idea behind the script is to schedule backups at times the user will probably never see the toast message.

I have now set it so by default only the date is used in the backup folder naming. If the backup folder name is already in use date + time is used.

I don’t expect that to happen often, it’s just an extra safety check.

Please try the script and let me know your findings.
[Android Apps and Games] rf69:
[MENTION=3306843]kantjer[/MENTION] I understand and totally agree.. Going to download it now and update you on my findings.. ;)
[Android Apps and Games] rf69:
Not sure what the problem is, maybe it's a bug (or something)..

1 - The backup runs (no error in tasker's log)

2 - Reboots into Recovery

3 - Then only shows the main screen of TWRP, where you can manually interact

It's like the openrecovery script doesn't run. :(
[Android Apps and Games] kantjer:
set a stop in the TWRP backup task after line 27 and run the script.

Then check the openrecoveryscript file located in the internal memory, or better post the content of that file
[Android Apps and Games] rf69:
It doesn't look like anything is wrong, it looks like this:

"backup SDCB 11-1-16_M4B30X" (without quotes)
[Android Apps and Games] kantjer:
That look's OK

In the 2 years I use the script it happened to me once that the ROM booted into recovery without executing the script.

Please remove the stop and try again, could be bad luck :fingers-crossed:
[Android Apps and Games] rf69:
Haha damn :laugh: ... I have tried it 2 times this morning, will test again tonight and update you.

Thanks :fingers-crossed:
[Android Apps and Games] kantjer:
one last test you can do make 100% sure the script is working

set a stop for the reboot to recovery line, run the script and check if the openrecoveryscript is moved to /cache/recovey

If that's OK the script did it's thing
[Android Apps and Games] rf69:
It moved correctly & content is still fine.. Let's see what happens when i run it again.. ;)
[Android Apps and Games] kantjer:
Then the Tasker script did what it's supposed to do.
[Android Apps and Games] rf69:
If i change the directory as attached, it will backup to SD Card correct?
[Android Apps and Games] kantjer:
If that's were you're backups are stored yes but I would be surprised.
[Android Apps and Games] rf69:
I did it like that on the previous script and it worked..

It could also be why I'm facing the current issue (I'll revert to default settings and try again)..

If it works I'll change the directory and test again.. :cool:
[Android Apps and Games] rf69:
I removed the script completely, reloaded the original script and it works..

Now i just have to change it to verify against my SD Card backups and not the empty Internal Storage backup folder..

I have one question, if i set the script to run every day (via Profile) but the "backup interval in days" to 3, will it only backup every 3 days.?

Thanks ;)
[Android Apps and Games] iPAQ 6515a User:
Have been testing the latest setup with 100% success.

Just added an adjustment in tasker to create /cache/recovery folder, as with each boot my 3c wipes cache. And a first question: "How to create 'if' formula to create folder so that tasker tries to create the recovery folder only if it is not there (otherwise the task will stop)?"

Question 2:

Can you help me create a command to check for the free space on my extcard (running Marshmallow), if less than 8.5GB than stop the task (or else the phone gets stuck in TWRP, that leads to no alarm call, which in turn creates unwanted consequences)?

TIA

PS

Could you update OP's link to openrecovery with this one?
[Android Apps and Games] kantjer:
I didn't even knew there are situations the recovery folder isn't present. Always thought TWRP took care of that.

I will add a check and create.

I like your second suggestion about the free disk-space check.

What I'm thinking of is instead of adding the size manually take the size of the last nandroid, add say 25% and use that as a minimum free disk-space for the script to continue.
[Android Apps and Games] iPAQ 6515a User:
I forgot to add I changed the openrecoveryscript parameters to not backup cache, not create md5 and to compress the whole nandroid. In this case your idea may not work as TWRP needs to have at least the amount of the uncompressed size of the parts to backup.

In TWRP I have removed that check by default, but don't know how to do that in openrecoveryscript
[Android Apps and Games] kantjer:
I'm planning to add a multiplier factor to set the needed free space compared to last made backup.

I think 1.25 will be sufficient for normal use, if you use compression you can increase that easily.

As an alternative it should be easy to convert the script to a fixed value if you ant to go that route
[Android Apps and Games] rf69:
[MENTION=3306843]kantjer[/MENTION] I think you missed my question, please see quoted above (not sure about backup interval).. ;)