Asking for Authorization

I have a shell script (asr restore) in my applescript that takes a while to run. Later in the script, I have another function that is used ‘with administrator privileges’. My script asks for name and pw a second time as it was longer that the timeout (5 minutes?).

What do people do to avoid that? Prompt for name & pw, and store it in a variable for later use?
thx

Run the process in the background with administrator privileges and make the main script a controller. This way you won’t get prompted a second time because the process itself runs as root and can run for days. You can use a named pipe between these processes to communicate between them.