2

I am running a long running script on a Scientific Linux server with Kerberos and Andrew file system, by

myscript.sh >log 2>&1 &

Upon starting the command, I didn't see a file called log in the current directory, but saw a file called .__afs063D which is logging the outputs on stdout and stderr.

The script is still running. why is log not created? When will it be?

jsbillings
  • 24,006
  • 6
  • 56
  • 58
Tim
  • 98,580
  • 191
  • 570
  • 977

1 Answers1

2

Files like .__afs063D are created when a process has a file descriptor open but the file has been deleted. Its how the AFS cache handler handles that situation. Next time the volume is salvaged, it will be removed.

jsbillings
  • 24,006
  • 6
  • 56
  • 58
  • (1) But I don't delete the log file, but redirect to it. why is the hidden file created, but my log file isn't? (2) What do you mean by " the volume is salvaged"? – Tim Jan 11 '16 at 02:38
  • Perhaps you are seeing the output of another process, and you deleted a previous version of the log file but neglected to kill off the background process? – jsbillings Jan 11 '16 at 02:39
  • AFS volumes are [salvaged](http://docs.openafs.org/Reference/8/salvager.html) by the volume server periodically or during maintenance (depending on how your cell is run). Think of it as fsck for AFS, run by the AFS volume server. – jsbillings Jan 11 '16 at 02:41
  • My actual command is `myscript.sh > predict/log 2>&1`. In `myscript.sh`, I want to have a dir `predict` with empty content, where `myscript.sh` will create some files, but without relying on `predict` existing or being empty, so I do `rm -rf predict; mkdir -p predict`. Is that the reason? – Tim Jan 11 '16 at 02:43
  • Possibly. It depends on the order of commands. – jsbillings Jan 11 '16 at 02:45
  • I use dir `predict` to store the files created by `myscript.sh` and also a log file created by redirecting the script's stdout/stderr output. I want to have `predict` empty at the beginning of the script, without relying on `predict` existing or being empty. What would you do if you were me, to avoid the problem in my post? – Tim Jan 11 '16 at 02:50