yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] iPAQ 6515a User:
Doing that now, with no good results.... Line 4 with the backup location is not there... It is so strange

UPDATE

It looks like Tasker "stores" the history of the performed tasks. When you build a script on top of the previously used it tends to is affected by it.

After removing all data from Tasker (deleted everything: uninstalled the app, cleaned cache, etc) I started adding the latest test scripts starting with the retention.

Guess what? No list directory in line 4, added it manually and ran the task. Success. It deleted my manually done backups.

Time to import backup tsk (with the changes I always add: cache/recovery folder creation in line 1, SDBOM instead of SDCBOM, space check disabled)

Btw, needed to import disk check script to make it run. Guess what, again? The task would work only the first time, after that it stopped in recovery due to same-name-directory error (mentioned by another user previously).

Added %H%M to the name format of the nandroid and now the backup task runs smoothly with one big problem: the retention task does not delete anything anymore.

Tried to go back to the original scripts from the OP by importing it over, with no results (scripts got messed up).

Cleaned everything again and the OP scripts work flawlessly.

Decided to go to the penultimate test scripts but I deleted them by mistake and they do not exist under the link you posted (sb please reup them for me).

I ran last test, imported the latest test scripts over the OP ones.... same results as above.

It looks like upgrading scripts over the previous ones makes them work but if I do it with some upgrades-in-between skipped, the scripts go awry.

UPDATE 2

Even the OP retention script stopped working. Weird. Have no idea what is going on.

Somebody else could confirm it is not only me?
[Android Apps and Games] milt983:
Hi! I have similar problem: added %H%M to the name format and, as result (it is althoug logical, because the backup name is never the same), no one backup is deleted from retention task.

For this I suggested - and I ask again to kantjer - if it is possible, to point to the

number

of the backups present on the default folder instead of their names. I mean the quantity of the backups, something like the Titanium Backup retention: you decide how many backups to keep, then, the older backup is always deleted from the newest backup. Very simple way. This could solve the retention problem, independently from the backup name.
[Android Apps and Games] iPAQ 6515a User:
Give root access to the retention task and it will work....

But the backup task does not recognise the requirement of the day between backups and always runs. Had to set up the profile to run on Saturdays only
[Android Apps and Games] kantjer:
The backup will always run until the number of set backups is reached.

After that the interval is used.
[Android Apps and Games] kantjer:
That's what's done now.

We still need a routine not only to determine the number of backups but also the age.

Beside that I have been using the current routine for years without any issue on several phones and android versions.

Currently I'm running Android 7.1.1 and it's still working
[Android Apps and Games] milt983:
Ok, I see... But, in my experiece, this not worked. For this I ask if is possible to remove the name and leave only the number of backups for retention.

Is it possible this?
[Android Apps and Games] kantjer:
The name isn't used.

The list action just reads the number of directories in the backup folder, counts the number of directories and if needed delete the oldest one.

A name is needed to know the backup to delete.

Nothing I can change about that.
[Android Apps and Games] milt983:
So, why the retention in my backup won't works? How you explain it?
[Android Apps and Games] kantjer:
I have no idea why it isn't working for you.
[Android Apps and Games] Schwarzauge65:
Hi, I have downloaded and installed the test-version. In the post 174 shows the picture, that you have in the TWRP retention task under point 4 and 6 list files tasks. These entries are not in the test version

Gesendet von meinem D5803 mit Tapatalk
[Android Apps and Games] iPAQ 6515a User:
Here's the working retention (old) script
[Android Apps and Games] milt983:
Yes, this work fine, with just a simple correction in the folder address (ext_sd, in my case). Thank you!
[Android Apps and Games] rf69:
Can anyone help me with the attached image. Why is the "%bu_folder_size" unset.?
[Android Apps and Games] kantjer:
because the task is incomplete, you are missing a "List Files" command before the error.
[Android Apps and Games] rf69:
I added the "List Files" from the previous version, but doesn't work.. Can you please send me your Disk Space Check xml :)
[Android Apps and Games] kantjer:
my current profiles and tasks, exported using the most recent Tasker version from Google Play

https://www.androidfilehost.com/?fid=745425885120695421
[Android Apps and Games] iPAQ 6515a User:
This one works perfectly (except for disk check), go figure.
[Android Apps and Games] rf69:
I also have the latest version installed, will import this one & post feedback..

Thanks :cool:
[Android Apps and Games] rf69:
[MENTION=3306843]kantjer[/MENTION] Sorry it took so long, i was away for a few days.. I tested with your export, screenshot attached (if i change "line 18" to use Root it works, but 19 doesn't work either way).. Please help :fingers-crossed:
[Android Apps and Games] kantjer:
In your screenshot line 18 fails so 19 will fail as a result of that
[Android Apps and Games] HamsterHam:
Latest version works perfectly here.
[Android Apps and Games] rf69:
I am aware of that, i did troubleshoot the problem ;) .. Any suggestions on how to fix the error in "line 18"..?
[Android Apps and Games] kantjer:
Some phones just appear not to support the "df" command used.

I have no solution for that.

EDIT: made a post on the Tasker group on G+ to check if there is an alternative way to check free disk space.
[Android Apps and Games] rf69:
I found a solution, going to bed now.. Will post my changelog from your last export tomorrow..

:cool:

Edit: Nevermind, my method doesn't calculate the Free Space correctly
[Android Apps and Games] rf69:
[MENTION=3306843]kantjer[/MENTION] Herewith my "Disk Space Check" task fully working on SD card, don't know if it works Globally (didn't test Internal Storage, maybe you can)..
[Android Apps and Games] kantjer:
Thanks, I have also fished the alternative free diskspace check

I will compare my solution with yours
[Android Apps and Games] rf69:
I also know what the problem is on your script, the "grep /dev" is wrong on SD.

On SD the partition start with "/mnt/..."

;)
[Android Apps and Games] kantjer:
I moved away from the "df" statement and are now using a more universal "stat" command to get the number of available blocks and the block size to calculate the free diskspace.

The free diskspace code is cleaner now (no more variable split), and will hopefully now work for all users.

I will post an update to test asap.
[Android Apps and Games] rf69:
Wow, that does look much cleaner :cool:
[Android Apps and Games] kantjer:
New test with updated free disk space check, hopefully this will now work for everyone :fingers-crossed:

https://www.androidfilehost.com/?fid=385035244224408671

Only the TWRP_disk_space_check is changed
[Android Apps and Games] rf69:
Works perfectly on SD Card, thanks :D
[Android Apps and Games] rf69:
[MENTION=3306843]kantjer[/MENTION] Sorry to bother you again. Just wanted to share with you the changes i made to the "TWRP disk space check" for improved accuracy on compression size.

NOTE#1: You are welcome to calculate the values given below for yourself.

NOTE#2: Nothing changed since my last backup so there will not be a big change in Disk Space.

Here are the values of my last backup with Compression enabled (calculated without tasker):

1) Available Space (checked before running backup) - 9950 MB

2) Size needed for backup (according to "TWRP disk space check") - 9.73 (9730 MB)

3) Size of Data (checked during TWRP backup progress) - 7225 MB

4) Size of TWRP Nandroid backup (done) - 4530 MB

As you can see, it is asking for way more space than necessary so according to those values i updated the following in "TWRP disk space check" (maybe you would want to update the script ZIP file as well for everyone to download):

1) Line 1 (set needed disk space multiplier) - "1.10"

2) Line 3 (set backup compression factor) - "0.62"

3) Line 6 (set backup compression factor) - "0.62"

By changing those values, your script now says - Size needed for backup (according to "TWRP disk space check") - 8.03 (8030 MB).

As you can see, it's much more accurate (i don't want to go too low for Data changes) since last backup.
[Android Apps and Games] iPAQ 6515a User:
Thank you for the update, unfortunately I am getting this error. Any idea, what that could be?
[Android Apps and Games] rf69:
Just set Line 10 to use root (that worked for me).. ;)
[Android Apps and Games] iPAQ 6515a User:
It's there and in line 9. No dice :(
[Android Apps and Games] rf69:
I've tested your way, then mine doesn't work.

Try the following:

1) Line 9 - No Root

2) Line 10 - Use Root

Hope it helps (P.S. - I backup to SD Card)

;)
[Android Apps and Games] kantjer:
Same old issue, your phone doesn't like the "du" command

Check if this works

https://www.androidfilehost.com/?fid=673368273298920562
[Android Apps and Games] iPAQ 6515a User:
Hey, thank you for your prompt answer. The link you shared does not work, can you please reup the task?

TIA
[Android Apps and Games] kantjer:
Try again, link should work now
[Android Apps and Games] kantjer:
AFAIK TWRP will stop if the available space is lower then the calculated free space needed by TWRP.

So in your example the backup stops if the available space is lower then 9730 MB

TWRP calculates the needed space without compression.
[Android Apps and Games] iPAQ 6515a User:
Unfortunately, it is not. Any chance for the usual server?
[Android Apps and Games] kantjer:
It is the usual server, the link is working for me
[Android Apps and Games] iPAQ 6515a User:
Weird, it takes me to filehost.com, and shows domain for sale
[Android Apps and Games] kantjer:
LOL, buy the AFH domain and sell it back :D

Zip attached to this post
[Android Apps and Games] iPAQ 6515a User:
Hahahaha, that was a good one.

Thank you for the zip
[Android Apps and Games] kantjer:
I hope it works now, could be you need to give the new method root access :fingers-crossed:
[Android Apps and Games] rf69:
Yes i know & it is working perfectly..

Sorry for the unnecessary long post, just wanted to share the correct compression ratio (0.62).

Thanks for all your work on the script :cool:
[Android Apps and Games] iPAQ 6515a User:
I think I know what the problem is, the task looks for folder in emulated sd card whilst my backups are on external card (marshmallow xxxx-yyyy format)

Tried to edit dir list but am getting error 1
[Android Apps and Games] kantjer:
A few days ago my scheduled nandroid failed

I found the cause was the recovey.log was so large it had filled my /cache/recovey folder.

I have added a routine to clear the recovery log before each backup.

I now exported the scheduled nandroid as a project, making it much easier to export and import.

Download
[Android Apps and Games] rf69:
Awesome, thanks.. Will add the additions.. :D
[Android Apps and Games] Donglip:
Appreciate the update solving some problems and doing the program more accurate.

Very good work, and thank you to share.
[Android Apps and Games] reawo:
Hello [MENTION=3306843]kantjer[/MENTION], i just tested the script and it worked flawless! really love it!

oh and what command do i need to change to provide the correct path to my sd-card for the retention script?

my SD Card path is: Root/Storage/6636-6431/TWRP/BACKUPS

now what i'd like to see is that tasker automatically enters my sim pincode after the reboot from the backup is complete - is there any way to make this work?
[Android Apps and Games] kantjer:
The retention task doesn't have a path setting, the path should be set by the backup task and is stored in the "%BU_root_folder" variable

I don't think Tasker can enter the SIM PIN, if you want to have it added automatically removing it should be a better option.
[Android Apps and Games] reawo:
[MENTION=3306843]kantjer[/MENTION]

how can I edit that variable?

When i changed it to the path i mentioned above the retention task still put out an error while showing the old path
[Android Apps and Games] reawo:
[MENTION=3306843]kantjer[/MENTION] i checked the behaviour of the script on my device - it saves the backup at the right location but it does backup every day since it doesnt know the correct folder to check the age of the backups...

if u can teach me how to change the variable of the folder everything should be as intended, hope you can help me
[Android Apps and Games] kantjer:
Try changing the path here
[Android Apps and Games] reawo:
[MENTION=3306843]kantjer[/MENTION] i don't know how to do that - tried to put a value to the variable in the variables tab but i'm not even sure if i did it correctly

i'm really new to alls this stuff so maybe you could guide me through this? we could talk through pm if thats better?
[Android Apps and Games] reawo:
[MENTION=3306843]kantjer[/MENTION]

EDIT: the problem is that it automatically puts in storage/emulated/0

that's what I get now

i think its trying to scan internal SD card, but TWRP does the backup to external SD card and thats where the scrip has a hickup

when i go through rooted file explorer and go to storage/emulated/0 i get my internal SD

and the other one is listed under ROOT/STORAGE/6636-6431/
[Android Apps and Games] kantjer:
Like I mentioned in my previous post you need to point to your external_sd path.

I don't have an external and have no clue what the mount point is on your device, could be something like " /mnt/sdcard/ext_sd/TWRP......."

Perhaps others with an external sd can pitch in here.
[Android Apps and Games] reawo:
[MENTION=3306843]kantjer[/MENTION]

i edited my post right before you answered, it automatically puts in storage/emulated/0 in front of whatever i give it to work with, think that's the culprit

could it be the %budir variable thats causing this? but i cant find where to change it
[Android Apps and Games] iPAQ 6515a User:
Go to retention task and edit the 4 line list files
[Android Apps and Games] reawo:
i made it work.

Had to put in the proper values for my backup folder and

had to grant tasker permission for SD card

attached my config if anyone is facing the same issue

Thanks a lot for this awesome script! =)
[Android Apps and Games] kantjer:
glad it's finally working for you :good:
[Android Apps and Games] milt983:
Hi! I upgrade my phone (P8 Lite) to Android 6 from 5. My script works properly before but now, it won't works... :(

I attached a screening of the task script.

Please, what is wrong?

Thanks in advance.
[Android Apps and Games] iPAQ 6515a User:
Pretty sure it's the path to the ext card. It will be in another task though
[Android Apps and Games] milt983:
I'm not so sure. The backup folder is correct. Something goes wrong with "task retention" and "task disk space check"
[Android Apps and Games] milt983:
I checked the backup folder again (in case the advice of iPAQ was correct). The folder is the right one.

I think there is some problem caused by the script in relation to android 6.

No one have any idea about it?
[Android Apps and Games] kantjer:
The script worked perfect for me when i was using android 6
[Android Apps and Games] milt983:
Thank you for the reply.

I see...

Unfortunately in my case it does not work. I think it has to do with some permission (or parts of the scipt that needs to be modified) because of the external microsd and the restrictions of android 6. I say this because the script (as I have already said) worked perfectly (with Android 5) before upgrading to android 6.

Unfortunately, I do not know how to edit the script to solve :(

Many thanks!
[Android Apps and Games] reawo:
did you give Tasker access to the external sd card?

-> more/android settings/grant document tree access
[Android Apps and Games] voetbalremco:
My phone has not enough space left for 2 TWRP backups.

Would it be possible to do the retention (backup once in a week) check, delete the old backup and then make a new one instead?

Currently it fails because of the insufficient space and doesn't do anything further.
[Android Apps and Games] milt983:
Yes, I had already given the permission but Tasker still does not work properly.

Even the simple "reboot recovery task" does not work. I do not know if, in addition to some error in backup scripts, it also depends on a problem with Tasker.

I made a short video (1 minute) to show Tasker's behavior: http://www.screencast.com/t/GnnCvwMPUJ

Thanks!
[Android Apps and Games] kantjer:
I already built in a routine to delete backups when disk space isn't sufficient but as it is now I set it to never delete the most recent backup.

In your case that's not going to work. I have an idea and will look at this later.
[Android Apps and Games] milt983:
Is it so difficult to solve this? Come on guys, give me some suggestions or help, please.
[Android Apps and Games] kantjer:
deleted
[Android Apps and Games] rignfool:
I'm waiting for the day your avatar goes from Kyle... To Cartman
[Android Apps and Games] kantjer:
I have days I feel like Cartman :D
[Android Apps and Games] kantjer:
the only thing I noticed in the video you uploaded is that the phone didn't boot into recovery at the end of the script
[Android Apps and Games] milt983:
Ok. This seems to be the problem. So, what can I do to solve it? I have a rooted phone and I have given all the necessary permissions to Tasker. If I do a "Restart to Recovery" from another app, for example from Quick Reboot Pro, restart works perfectly (and backups, that had been programmed by taskers, work perfectly too). Only Tasker does not restart the device.
[Android Apps and Games] _Sherrif:
[MENTION=5860864]milt983[/MENTION],

i assume you have granted Tasker SU permissions? I had the same problem a while back and that was my trouble. Look in your SU app to verify you have given permission to Tasker for SU rights. If not, go to task, then task edit for disk space check and run the program, if SU has not been requested it will be then. It may be the retention task can't remember, but one if them prompts for SU permission.

.

Hope this helps. I would hate to not have this wonderful program so i can understand.
[Android Apps and Games] milt983:
Thank you _Sherrif!

Yes I have granted SU permission as all the other permissions.

But... a big THANK YOU! Thanks to your advice, I reflected on the possibility that Busybox should be placed in another directory. So, I moved Busybox from su/bin to system/bin and... VOILA! It worked! Thanks again!
[Android Apps and Games] _Sherrif:
Great! Glad you got it fixed...:good:
[Android Apps and Games] milt983:
Hello! I did a nandroid backups with "Online Nandroid Backup", with the name (automatic by O.N.B.) "ALE-L21C432B600".

In my TWRP Backup task, the name is "BalongC52B311". Anyone know how do I change the variable (in the backup task) so that the name “ALE-L21C432B600” appears in my tasker nandroid backup?
[Android Apps and Games] Donglip:
Installed. Works perfectly With Oreo, and TWTP Blu_Spark v8.52. (oneplus3).

Thanks a lot.
[Android Apps and Games] immi:
Hello master [MENTION=3306843]kantjer[/MENTION]

I've been using these scripts for over 6 months and I must say that these are very very useful. I have one small request now. Can you please make a script that would backup(or Copy & Paste) Device's Internal Storage to a selected folder in External SD Card, and Delete old copies automatically and periodically. I'm really a noob in this matter and can't make such scripts on my own. Thank You in advance.
[Android Apps and Games] kantjer:
Check FolderSync app in Google Play, AFAIK it can do that out of the box.

I have no external SD so no way I can test something like that.
[Android Apps and Games] lord3000:
Can someone explain me what the Test File section means?

When I run the backup task, everything turns green till "Backup start" and it stops without errors. (Use Root disabled)

I'm a noob at Tasker, but when I set it at "Continue Task After Error" + "Use Root enabled" I always get a red dot at the Test File section.

Everything works fine then, but my older backups won't delete. (I've set it to keep 1)

In the Log I only see this:

ErrIgnore 2:5.5 TWRP backup.Test File, %BU_TIME=%BU_TIME

How can I fix this?
[Android Apps and Games] voroxda:
First of all thank you very much for sharing your knowledge about the commandline interface of TWRP.

For me it was a complete new stuff. I see a high potential on other solutions like a one tap wipe off cache+dalvik cache. I wrote this, because i have made a dramatic experience with this solution. Not to be misunderstood: I do not won't to blame anyone, only to tell my experience, to help other in the same situation.

What happened?

After adapting your Tasker script with personal settings like backup destination, I had started the Tasker script "TWRP backup". Everything proceeded as expected. Tasker booted into recovery. The backup started as configured the four partitions. After finishing TWRP want to reboot to system and runs into a bootloop. After forced start (volume down+power button), system starts in a kind of emergency mode. All big cores were disabled (see picture below). After this no normal reboot was possible. After two forced reboots (volume down+power button very long time pressed) the systems doesn't not start anylonger. What a horror. To soft brick the device on this manner.

My solution was, to boot into recovery again ( also via forced mode) and to recover the boot partition. After this everything was fine again.

My knowledge isn't great enough to explain this behavior. I think it depends on my personal situation (device, rom, TWRP version) and the side effect is not valid for everybody. But you must be careful.

Best regards
[Android Apps and Games] _Sherrif:
@ voroxda

I know you stated you were JUST sharing your nightmare experience with us, but i am not sure if the original script could have caused this. I run a slightly modified script of kantjer's to handle my needs, but no where in the script do i see anything that could have caused the boot partition to be removed or messed with at all. It is only backing up the partitions listed. Did you change anything to the script? If so, upload it here so kantjer can look at it, he and other users are sharp with tasker and the ORS scripts and may be able to shed some light on the issue.

In reviewing the ORS just now i guess if different commands were added something like this could happen, but it would have to be initiated by the user.

Again i am not a scripting power user, but i use the program everyday and have been for almost a year, with my personal modifications and have never had a problem. i really hope you get this figured out so it never happens again.

Just trying to help you get some resolution to this, i know i would want to know!