[Asus Transformer TF700] elfaure:
[Q] Text file busy error?

I am having problems with silencing errors in my startup scripts. I get "text file busy" errors often when I append the following to the end of commands. Can someone tell me why?

&>/dev/null

2>/dev/null

2>&-

None of the following silence a umount error. For example, trying to unmount a directory that isn't already mounted. Instead they halt the script with the error "text file busy". How can I run this command silently, displaying no stdout nor stderr at the terminal?

[Edit] Very strange. When this "text file busy" error occurs my prompt changes and shows a [1] next to it indicating a non-zero exit code and the script fails to complete. If I continue to run the same script over and over it always generates this error even if I umount all mounts. BUT if I reboot and re-run the script it runs fine?? Then if I edit any line and add a "2>/dev/null or 2>&-" the error comes back and doesn't go away until after the next boot. WT# is going on here?????????

umount /data/data/com.android.browser/cache 1>&- 2>&-
umount /data/data/com.android.browser/cache 1>/dev/null 2>&1
umount /data/data/com.android.browser/cache &>/dev/null
umount /data/data/com.android.browser/cache 2>&-
umount /data/data/com.android.browser/cache 2>/dev/null
umount /data/data/com.android.browser/cache >/dev/null
umount 2>&- /data/data/com.android.browser/cache

[Edit-I found that I had the script file open in a text editor at the same time I was running it at the terminal which generates "text file busy" error and halts the script. All of the above silence the umount errors except the next to last one.

Notice the "1" prepended to the user prompt info below indicating that the command exited with error code 1 but it was silenced at the terminal. All of these terminal commands were captured trying to umount a non-existing mount which I umounted before running this terminal session.]

Here is an example list of ways to silence 1=stdout and/or 2=stderr terminal command errors (lines 1,2 and 4 appear to be equivalent):

u0_a87@android:/ $ umount /data/data/com.android.browser/cache >/dev/null 2>&1
1|u0_a87@android:/ $ umount /data/data/com.android.browser/cache 1>/dev/null 2>&1
1|u0_a87@android:/ $ umount /data/data/com.android.browser/cache 2>/dev/null
1|u0_a87@android:/ $ umount /data/data/com.android.browser/cache &>/dev/null
1|u0_a87@android:/ $ umount /data/data/com.android.browser/cache 1>&- 2>&-
1|u0_a87@android:/ $ umount /data/data/com.android.browser/cache 2>&-
1|u0_a87@android:/ $ umount 2>&- /data/data/com.android.browser/cache
1|u0_a87@android:/ $

Silencing Umount Errors: Here is a new subroutine structure I created that eliminates umount errors by not creating them. I did this because I can't couldn't figure out how to run umount silently as discussed above. This code checks first to see if there is a mount(point) to unmount, and only runs umount if there is. Then it proceeds to clean out the /cache and mount the tmpfs in either case. You can alternatively use the mountpoint command (if mountpoint /data/data/com.android.chrome/cache;" or a few other advanced ways instead of mount | grep to do this. [If 1=Then, If 0=Else] Example for Chrome:

if [ -d /data/data/com.android.chrome ];
then
if mount | grep /data/data/com.android.chrome/cache;
then
umount /data/data/com.android.chrome/cache
rm -rf /data/data/com.android.chrome/cache/* 2>&-
mount -t tmpfs -o size=100m chrome_cache /data/data/com.android.chrome/cache
else
rm -rf /data/data/com.android.chrome/cache/* 2>&-
mount -t tmpfs -o size=100m chrome_cache /data/data/com.android.chrome/cache
fi
fi