[GUIDE][Difficulty: Intermediate] Weekly TWRP Backups

Search This thread

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508

Attachments

  • 1459149494733.jpg
    1459149494733.jpg
    93.8 KB · Views: 133

huladaddy

Senior Member
Jul 10, 2012
382
67
Edit: Method 2 – Check the Modified Date of Backup Folders
So the other way is to just go through each of the folders and see if their date of modification is older than X days. If so, then delete them. This method doesn't require that you've set up the names in any specific way; only that they're in separate folders, so you can just add %DATE without the other steps in the post above. This method goes as follows:

Instead of the Files --> Delete Directory action, you need to add several actions, which will delete all the backup folders that are not the 3 latest.
You should reword this to "that are not more than 14 days old."

Here are the actions:
Code:
1. List Files: [i]dir[/i] [B]TWRP/BACKUPS/YOURDEVICEUNIQUEID[/B] [i]variable[/i] [B]%dirs[/B]
     [COLOR="DimGray"](where YOURDEVICEUNIQUEID needs to be set appropriately, as described in OP)[/COLOR][/QUOTE]
If I wanted to only check the scheduled backups, and not any manual backups I may have done in TWRP, and assuming that I named my scheduled backups with the prefix "auto-", would I just have to change the above line to:
[CODE][i]dir[/i] [B]TWRP/BACKUPS/YOURDEVICEUNIQUEID/auto*[/B]
?
 

Follow_and_Feel

Senior Member
Apr 7, 2014
528
216
Montabaur
K, sure. Turns out the names method is simpler but requires more setup in the backup naming. I'll add in the end of the post the other method.

Method 1 – Check the Name Backup Folders
First you need to add the date to the backup dir's name. But it has to be formatted in a way that, when sorted alphabetically, it'll sort the backups chronologically. So the format I'm showing is yyyy-mm-dd (same as %DATE but reversed, so years are in front). Here's the actions to set up that name:
Code:
1. Variable Set: [i]name[/i] [B]%date[/B] [i]to[/i] [B]%DATE[/B]
2. Variable Split: [i]name[/i] [B]%date[/B] [i]splitter[/i] - [COLOR="DimGray"](dash)[/COLOR]
3. Variable Set: [i]name[/i] [B]%date[/B] [i]to[/i] [B]%date3-%date2-%date1[/B]
Following that, instead of Tasker's built-in %DATE, you can use %date, and it'll represent the current date in yyyy-mm-dd format (so today is 2016-03-11).
After that definition, add the tasks, described in the OP with the following corrections:

1. instead of backup SDBOM weeklybackup use backup SDBOM Backup-%date – adding the %date variable, set up above
2. instead of the Files --> Delete Directory action, you need to add several actions, which will delete all the backup folders that are not the 3 latest. The logic behind the loop is get the names of all directories in alphabetical order (which arranges them from oldest to newest), and deleting all folders except the last 3 (which are the 3 latest). Here are the actions:
Code:
1. List Files: [i]dir[/i] [B]TWRP/BACKUPS/YOURDEVICEUNIQUEID[/B] [i]variable[/i] [B]%dirs[/B]
     [COLOR="DimGray"] (where YOURDEVICEUNIQUEID needs to be set appropriately, as described in OP)[/COLOR]

2. Variable Set: [i]name[/i] [B]%end[/B] [i]to[/i] [B]%dirs(#)-3[/B] [i]do maths[/i] [B]checked[/B]
     [COLOR="DimGray"](That'll gives the number of directories-3. Change that number to the amount of backups you want to save)[/COLOR]

3. For: [i]variable[/i] [B]%del[/B] [i]items[/i] [B]%dirs(:%end)[/B]
     [COLOR="DimGray"](For each of the directories from the first to the n-th last, defined in the action above, perform the following actions)[/COLOR]

4. Delete Directory: [i]dir[/i] [B]%del[/B] [i]recurse[/i] [B]checked[/B]
     [COLOR="DimGray"](this deletes the directory taken from the action above)[/COLOR]

5. End For
     [COLOR="DimGray"](ends the loop)[/COLOR]
And then you can set the SecureSettings Reboot to Recovery action, as described in OP.

Hope that helps. Haven't tested the whole thing with TWRP backups and reboot – only quickly test with some made-up directories. If you want to use this, it's not a bad idea to test yourself in a separate task before going all-in and incorporating everything in the main task. Though, that said, it should work fine.

PS: A quick note: TWRP will make a backup after that, so if you leave 3 backups, then you'll end up with 4. So keep that in mind, because you may not have enough space and in that case TWRP wont make the backup.


Not all that thoroughly tested but should work fine. Again – test yourself first before using it.

Hey there. I really appreciate the effort you've put in this. I was stunned about your knowledge and wanted this to work on my phone too.

I used method 1, but everytime I run the task it boots into TWRP and doesn't create a backup. There's just a short error message and then it goes back to the TWRP homescreen.

Do you know what may cause the problem? I've set it up just like you did. Unfortunately it's quite too difficult for me to figure out what the problem is, since I don't have any clue what all these tasks are doing :laugh: (I'm a noob).

Ah yeah and it doesn't reboot from TWRP, I have to do it manually.

Any help would be greatly appreciated :)
 

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508
Hey there. I really appreciate the effort you've put in this. I was stunned about your knowledge and wanted this to work on my phone too.

I used method 1, but everytime I run the task it boots into TWRP and doesn't create a backup. There's just a short error message and then it goes back to the TWRP homescreen.

Do you know what may cause the problem? I've set it up just like you did. Unfortunately it's quite too difficult for me to figure out what the problem is, since I don't have any clue what all these tasks are doing :laugh: (I'm a noob).

Ah yeah and it doesn't reboot from TWRP, I have to do it manually.

Any help would be greatly appreciated :)

Hey there,
It's probably be one of two things: Either you've typed the twrp script wrong and it doesn't regognize the commands, or (more likely) you don't have enough free space for the backup. While in twrp, after unsuccessful execution of the task, tap the button to show the log and you should see exactly what the error is.

Also, the reason it doesn't reboot is probably because it starts the backup command but is interrupted by the error (lack of free space) and thus doesn't get to the reboot command.

Take a look into that, that should probably fix it ;)

Cheers
 
  • Like
Reactions: Follow_and_Feel

Follow_and_Feel

Senior Member
Apr 7, 2014
528
216
Montabaur
Hey there,
It's probably be one of two things: Either you've typed the twrp script wrong and it doesn't regognize the commands, or (more likely) you don't have enough free space for the backup. While in twrp, after unsuccessful execution of the task, tap the button to show the log and you should see exactly what the error is.

Also, the reason it doesn't reboot is probably because it starts the backup command but is interrupted by the error (lack of free space) and thus doesn't get to the reboot command.

Take a look into that, that should probably fix it ;)

Cheers

Thank you for your reply. I was so frustrated that it didn't work that I went back to the original script in the OP.
But I will have a look after what you said when I have time this evening and will report back :)

I think it's the shell command that I got wrong. Could you give me the whole shell command with the new "Backup-%dates" line? That would be awesome :)

Thank you very much!
 

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508
Thank you for your reply. I was so frustrated that it didn't work that I went back to the original script in the OP.
But I will have a look after what you said when I have time this evening and will report back :)

I think it's the shell command that I got wrong. Could you give me the whole shell command with the new "Backup-%dates" line? That would be awesome :)

Thank you very much!

Sure, here's the whole thing, but it's literally the same, just with one word changed:
Code:
chmod 0777 /cache/recovery
echo "wipe cache\nwipe dalvik\nbackup SDBOM Backup-%date \ncmd reboot" > /cache/recovery/openrecoveryscript
 
  • Like
Reactions: Follow_and_Feel

iPAQ 6515a User

Senior Member
Mar 24, 2008
912
234
DF
Suddenly the task stopped working. Now am getting the error that tasker could not delete the folder on my ext card

Running AOSP 6.0.1 JDCTeam

Anyone with similar problem? Any solution to that?
 

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508
Suddenly the task stopped working. Now am getting the error that tasker could not delete the folder on my ext card

Running AOSP 6.0.1 JDCTeam

Anyone with similar problem? Any solution to that?

Any chance that the folder doesn't exist? If Tasker tries to delete a folder that doesn't exist, the action will return error. If "Continue on error" is not checked, the task will stop and not finish.
 

iPAQ 6515a User

Senior Member
Mar 24, 2008
912
234
DF
Any chance that the folder doesn't exist? If Tasker tries to delete a folder that doesn't exist, the action will return error. If "Continue on error" is not checked, the task will stop and not finish.

It does exist. I think I found the culprit: MM gives a lot of headache in terms of permissions to access extSD, so I started using Apps2SD in order to link folders from extSD to intSD, thus to save space on my internal storage. One of the linked folders was TWRP. I just unlinked it. Will need to wait 1 day to see, if the delete option works :)
 

huladaddy

Senior Member
Jul 10, 2012
382
67
Hmm... I've been running this task manually for a while and finally decided to automate it, but I can't seem to get it to trigger on the time I specify. Any ideas why?
 

huladaddy

Senior Member
Jul 10, 2012
382
67
You would need to give more info. What are you doing exactly and what is happening?

I have three contexts set: 1) day of week, 2) power state, and 3) time of day. The day of week context is coloured green, meaning it is satisfied, the power state is also green. I can set the time of day to a few minutes in the future and watch that time come and go, but the task does not get triggered. It doesn't matter if the screen is on or off. I have tried turning the task off, then turning it back on again. I've tried UTC time.

---------- Post added at 02:39 PM ---------- Previous post was at 02:27 PM ----------

Got it working. Apparently it didn't like what I was trying to do to isolate the automatic TWRP backups from manual backups. So let me ask you again, how could I have the For loop just delete old automatic backups, and leave any manual backups I may have done, regardless of age?
 

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508
[…]So let me ask you again, how could I have the For loop just delete old automatic backups, and leave any manual backups I may have done, regardless of age?

In the beginning, in the action "List Files", enter a matching pattern that collects your autobackups but excludes your manual ones. That's it.
 

huladaddy

Senior Member
Jul 10, 2012
382
67
In the beginning, in the action "List Files", enter a matching pattern that collects your autobackups but excludes your manual ones. That's it.

What I tried before was this:

Code:
dir TWRP/BACKUPS/YOURDEVICEUNIQUEID/auto*
but that didn't work. It prevented the task from completing and the phone didn't reboot and complete the backup.

What I am trying now is this:

Code:
dir TWRP/BACKUPS/YOURDEVICEUNIQUEID/
and below this line, there is a line called Match, and so there I added:
Code:
auto*

This allowed the task to complete and for the phone to do the TWRP backup. Now to wait a few days and see if the older "auto" backups gets deleted.
 

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508
What I tried before was this:

Code:
dir TWRP/BACKUPS/YOURDEVICEUNIQUEID/auto*
but that didn't work. It prevented the task from completing and the phone didn't reboot and complete the backup.

What I am trying now is this:

Code:
dir TWRP/BACKUPS/YOURDEVICEUNIQUEID/
and below this line, there is a line called Match, and so there I added:
Code:
auto*

This allowed the task to complete and for the phone to do the TWRP backup. Now to wait a few days and see if the older "auto" backups gets deleted.

Yes, that's what I'm talking about – Match. Your curent setup will check only files whose names start with the letters "auto". If that's how you name your backups, it should work just fine.
 
  • Like
Reactions: huladaddy

iPAQ 6515a User

Senior Member
Mar 24, 2008
912
234
DF
It does exist. I think I found the culprit: MM gives a lot of headache in terms of permissions to access extSD, so I started using Apps2SD in order to link folders from extSD to intSD, thus to save space on my internal storage. One of the linked folders was TWRP. I just unlinked it. Will need to wait 1 day to see, if the delete option works :)
UPDATE

Tasker is not able to delete files on my ext card on MM ;-(
 

Arstoien

Senior Member
Oct 31, 2012
1,438
1,508
Could you please elaborate on that? I am a real n00b when it comes to Tasker
With Tasker you can execute Linux commands. Thus, you can execute a command to tell the OS to delete a folder, regardless of where it is (given you have the right permissions). I can't test it but open Tasker, open Run Shell, and use any Linux command you want there. For example to delete a directory, you can use rmdir ( read more here http://www.mediacollege.com/cgi-bin/man/page.cgi?topic=rmdir ). Have a look on google for the native Linux commands that you can use in a terminal and that'll open your opportunities in Tasker quite a lot. All the "File" actions in Tasker can be done via commands.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    It's good practice to run a full backup of your ROM and user data every once in awhile, in case you flash something and get into a bootloop. Thanks to TWRP's scripting capabilities, we can trigger a weekly backup.

    Prerequisites

    1. Root Access

    jfH9PiZ.jpg

    Instructions

    1. Create a new Profile named TWRP Backup.
    2. Create a Time context, and choose a time at night you want the TWRP backup to take place. For me, I made it at 4:00AM. To pick a single time, check both "From" and "To" and put the exact same time in both.
    3. No need to name the task anything, just enter its configuration.
    4. Code --> Run Shell. This is the code you'll need:
      Code:
      chmod 0777 /cache/recovery
      echo "wipe cache\nwipe dalvik\nbackup SDBOM weeklybackup \ncmd reboot" > /cache/recovery/openrecoveryscript
      Be VERY sure that this is typed exactly as such! Tick "Use Root" and then exit.
    5. Files --> Delete Directory. Delete the TWRP/BACKUPS/YOURDEVICEUNIQUEID/weeklybackup. Check "Recurse." In order to get your device's unique ID, you need to simply navigate to TWRP/BACKUPS using any file explorer. You should have already made a previous backup, as TWRP will automatically create this folder. (Note: since you likely don't have a weeklybackup folder already here, it will likely fail the first time. You can easily just skip this action and make a backup once with this name, and then it'll work from then onwards).
    6. Plugin --> Secure Settings. Go to Root Settings --> Reboot Options --> Reboot Recovery.
    7. Exit out the task editing, and now add a few more contexts to make the backup run at an appropriate time. I added a power context so it only occurs when my phone is charging; I added a date context so it only runs on Sunday; and I also added a WiFi connected context so it only occurs when I'm at home.
    qzAJeR0.jpg


    That's it! This should satisfy the average TWRP user. MAKE THOSE BACKUPS!
    8
    /me raises his hand

    I've been meaning to get around to creating my own version of this profile to suit my needs. Some of the things you mentioned are of interest; however they are more advanced than my current knowledge. I've gotten pretty good at using If, Else and Stop If statements involving simple variables, though. Bring it on!

    Sent from my LG-D850 using XDA Labs
    Ok, but I'll be a little shorter in description, hope it's still clear:

    Every Day, if last backup is older than one week
    – if you want to save more of your last backups, look at my previous post. My current setup deletes the last backup and creates the new one (if older than a week), as described in op.
    – Here are the changes:

    1. Remove Sunday context from profile. That way the profile is only triggered by the time context, and it'll trigger every day.
    2. Test File: type Modified data TWRP/BACKUPS/YOURUNIQUEID/weeklybackup/ store result in %last_backup_mod_date
    3. Variable set: name %days_since to (%TIMES-%last_backup_mod_date) /60/60/24 do maths checked
    4. Stop: if %days_since < 6

    Enter PIN on reboot (only from this profile, not always)
    This needs some more setup. We'll simulate the touches of the consecutive numbers of your SIM PIN, so first we need to see what these coordinates are. Turn on Pointer Location in Developer settings. Now write down the X and Y coordinates of your numbers (you'll see them on the top of the screen).

    In the profile task you'll only have to add one action before the Reboot action:
    Variable set: name %TaskerReboot to 1

    Then make a new profile with contexts:
    1. Event: Device Boot

    2. Variable Value %TaskerReboot~1

    and the following actions in the task:

    1. Run Shell: command input keyevent KEYCODE_POWER use root checked if %SCREEN ~ off
    (this simulates a power button click, if the screen is off. So in other words turns on the screen. I'm not sure how many devices this will work on, but if it doesn't work, try SecureSetting Wake screen.

    2. Run Shell: command
    Code:
    input tap 540 910
    input tap 540 910
    input tap 540 910
    input tap 540 910
    use root checked
    (Each line simulates one tap. So these 4 lines simulate 4 taps of the number 3 on my screen. Change the numbers for your SIM PIN coordinates. The first is X and the second – Y.)

    3. Run Shell: command input keyevent KEYCODE_POWER use root checked if %SCREEN ~ off
    (that's just to turn off the screen. You can also wait for the screen time out.)

    4. Variable clear: name %TaskerReboot

    Don't trigger if too close to clock alarm
    Note that, if you are using "Use Reliable Alarms" in Tasker preferences, that may interfere, so you may have to turn it off with an action in this profile and back on after the alarm check. You'll need a plugin to read the time of next alarm. A good and free one is called ClockTask. After having the plugin installed, in the very beginning of the task, enter these actions:

    1. Next alarm change (ClockTask plugin): configuration Get next

    2. Variable Set: name %hrs_to_next_alarm to (%ctnext-%TIMES)/60/60 do maths checked

    3. Stop: if %hrs_to_next_alarm < 3.5 and %hrs_to_next_alarm > 0
    (change the values to your preference)

    Log the time and date of backup to a custom file
    Not needed for the profile to work, but if you're interested, that's easy. Just create an action "write file" and use date, time, and whatever you want there.

    Avoid rebooting if screen is on
    You can play with some scenes asking you what to do, if the screen is on when the profile triggers but I simply made it wait 15 minutes if the screen is on. Somewhere in the beginning of the task add the following actions:

    1. If: %SCREEN ~ on label Recheck Screen
    2. Flash: text TWRP backup pushed back 15 mins
    3. Wait: 15 mins
    4. Goto: type Action Label label Recheck Screen
    5. End if

    Hope that helps. Cheers!
    8
    I just made a modified version of the task myself with a few added functionality like:
    • Performs the backup on specific days of week
    • Notifies you when the backup process is about to take place
    • Gives you options to proceed with, cancel or postpone(by a few minutes) the backup process.
    • Proceeds with the backup process anyway if the user remains unresponsive for greater than 1 minute (like when you are sleeping)
    It handles only one backup (it deletes the old one before it starts taking the latest one).
    By default, the backup is taken on Tuesdays and Fridays at 3:30 AM. You can obviously change that.

    Screenshot_20161029-191017.jpg Screenshot_20161029-191025.jpg
    View attachment nandroid-backup.zip

    Edit : Fixed bugs related to profile contexts and repetitive executions of the task on selected day(s).
    5
    Are you saying that you know how to do this with tasker? If so, how? That's the real question.
    K, sure. Turns out the names method is simpler but requires more setup in the backup naming. I'll add in the end of the post the other method.

    Method 1 – Check the Name Backup Folders
    First you need to add the date to the backup dir's name. But it has to be formatted in a way that, when sorted alphabetically, it'll sort the backups chronologically. So the format I'm showing is yyyy-mm-dd (same as %DATE but reversed, so years are in front). Here's the actions to set up that name:
    Code:
    1. Variable Set: [i]name[/i] [B]%date[/B] [i]to[/i] [B]%DATE[/B]
    2. Variable Split: [i]name[/i] [B]%date[/B] [i]splitter[/i] - [COLOR="DimGray"](dash)[/COLOR]
    3. Variable Set: [i]name[/i] [B]%date[/B] [i]to[/i] [B]%date3-%date2-%date1[/B]
    Following that, instead of Tasker's built-in %DATE, you can use %date, and it'll represent the current date in yyyy-mm-dd format (so today is 2016-03-11).
    After that definition, add the tasks, described in the OP with the following corrections:

    1. instead of backup SDBOM weeklybackup use backup SDBOM Backup-%date – adding the %date variable, set up above
    2. instead of the Files --> Delete Directory action, you need to add several actions, which will delete all the backup folders that are not the 3 latest. The logic behind the loop is get the names of all directories in alphabetical order (which arranges them from oldest to newest), and deleting all folders except the last 3 (which are the 3 latest). Here are the actions:
    Code:
    1. List Files: [i]dir[/i] [B]TWRP/BACKUPS/YOURDEVICEUNIQUEID[/B] [i]variable[/i] [B]%dirs[/B]
         [COLOR="DimGray"] (where YOURDEVICEUNIQUEID needs to be set appropriately, as described in OP)[/COLOR]
    
    2. Variable Set: [i]name[/i] [B]%end[/B] [i]to[/i] [B]%dirs(#)-3[/B] [i]do maths[/i] [B]checked[/B]
         [COLOR="DimGray"](That'll gives the number of directories-3. Change that number to the amount of backups you want to save)[/COLOR]
    
    3. For: [i]variable[/i] [B]%del[/B] [i]items[/i] [B]%dirs(:%end)[/B]
         [COLOR="DimGray"](For each of the directories from the first to the n-th last, defined in the action above, perform the following actions)[/COLOR]
    
    4. Delete Directory: [i]dir[/i] [B]%del[/B] [i]recurse[/i] [B]checked[/B]
         [COLOR="DimGray"](this deletes the directory taken from the action above)[/COLOR]
    
    5. End For
         [COLOR="DimGray"](ends the loop)[/COLOR]
    And then you can set the SecureSettings Reboot to Recovery action, as described in OP.

    Hope that helps. Haven't tested the whole thing with TWRP backups and reboot – only quickly test with some made-up directories. If you want to use this, it's not a bad idea to test yourself in a separate task before going all-in and incorporating everything in the main task. Though, that said, it should work fine.

    PS: A quick note: TWRP will make a backup after that, so if you leave 3 backups, then you'll end up with 4. So keep that in mind, because you may not have enough space and in that case TWRP wont make the backup.

    Edit: Method 2 – Check the Modified Date of Backup Folders
    So the other way is to just go through each of the folders and see if their date of modification is older than X days. If so, then delete them. This method doesn't require that you've set up the names in any specific way; only that they're in separate folders, so you can just add %DATE without the other steps in the post above. This method goes as follows:

    Instead of the Files --> Delete Directory action, you need to add several actions, which will delete all the backup folders that are not the 3 latest. Here are the actions:
    Code:
    1. List Files: [i]dir[/i] [B]TWRP/BACKUPS/YOURDEVICEUNIQUEID[/B] [i]variable[/i] [B]%dirs[/B]
         [COLOR="DimGray"](where YOURDEVICEUNIQUEID needs to be set appropriately, as described in OP)[/COLOR]
    
    2. For: [i]variable[/i] [B]%processed_item[/B] [i]items[/i] [B]%dirs()[/B]
         [COLOR="DimGray"](starting the loop – going through each of the backup directories)[/COLOR]
    
    3. Test File: [i]type[/i] [B]Modified[/B] [i]data[/i] [B]%processed_item[/B] [i]store result in[/i] [B]%mod_date[/B]
         [COLOR="DimGray"](for each of the directories check the modified date)[/COLOR]
    
    4. Variable Set: [i]name[/i] [B]%days_old[/B] [i]to[/i] [B](%TIMES - %mod_date) / (60*60*24)[/B] [i]do maths[/i] [B]checked[/B]
         [COLOR="DimGray"](the result is in seconds, so here we convert it to days)[/COLOR] 
    
    5. Delete Directory: [i]dir[/i] [B]%processed_item[/B] [i]recurse[/i] [B]checked[/B] [i]if[/i] [B]%days_old > 14[/B]
         [COLOR="DimGray"](Delete the directory, if the modified date is from more than 14 days ago. Change the days to whatever you want)[/COLOR]
    
    6. End For

    Not all that thoroughly tested but should work fine. Again – test yourself first before using it.
    3
    No idea.. what I DO know is that this script gave me a hang on boot :<
    Make a complete backup before running the script for the first time!
    I am not sure yet why, but maybe someone (OP?) can help me out here..
    I'm using an HTC One M8 with Marshmallow rom (ViperOneM8) which is stock HTC Sense based.
    I use TWRP 2.7.8.0

    Did you try to wait longer? I thought mine also bootloop-ed until I remember that the wipe cache & wipe dalvik command would cause the phone to take a while to load. I waited around 10 minutes.

    ---------- Post added at 05:18 PM ---------- Previous post was at 05:18 PM ----------

    I do my backup to a usb-otg drive though. What do I need to modify in this profile to make sure that the backup gets stored only on the otg drive and skips entirely if no otg drive is mounted?
    Did you try: http://wiki.rootzwiki.com/OpenRecoveryScript

    ---------- Post added at 05:22 PM ---------- Previous post was at 05:18 PM ----------

    @MishaalRahman I found that you don't have to chmod 0777 in the beginning and you don't have to use "Secure Settings".

    I tested to touch the file in tasker and it created the file just fine.

    In regards to Secure Settings, I added the task code -> run shell -> 'reboot recovery'