I have read something about this a while ago on this forum, but cant seem to find it…
I have created a script to configure the devices using System–>Reset Configuration and enabling no backup / no default and then select script to run after reset.
My concern here is that this script also sets different levels of admin permissions and I want the script to auto delete itself after execution so that these credentials can not be accessed / viewed via the script file.
I tried /file remove [find where name=“mycript.rsc”] as last line and then the script fails / does not execute. Any reason why this will cause it to fail? If I remove that line, then script executes fine.
It’s only a guess, but I wouldn’t be surprised if the script file is locked during execution and can’t be deleted because of that.
I could imagine a workaround:
in your config script, create a scheduler item that runs on startup and deletes that file. It then removes itself from scheduler with the same procedure (this is proven working).
The last line of your config script would now be a reboot.
This way it works for both ramdisk and non-ramdisk devices.
Obviously, it does not cover “arbitrary” name. I simply use the same name all the time because why would I rename it, right? Not sure if there is a way to detect script’s own name