Manage Umask

The umask feature is used on UNIX to set the permissions on new files and directories. VOV supports umask with the environment variable VOV_UMASK. This variable is checked by the wrappers (vw, vov, etc. ). When set, the wrapper adjusts the umask accordingly.

The environment variable VOV_UMASK is automatically set to the value of the umask in the submit environment when using an environment snapshot in Accelerator.

If using a named environment, VOV_UMASK may need to be set separately. To do so, add D(VOV_UMASK=value) to the environment specification.
Note: The logfile of the job is created by the vovtasker, and its mode is controlled by VOV_UMASK. However, the date-stamped directory YYYYMMDD under vnc_logs is created at job submit time by the nc run command; the file permission (mode) of the logfile is controlled by the umask in the submit shell.

Examples with VOV_UMASK

This section provides examples of using VOV_UMASK.

In the following example, the umask is set in the current shell to a value that is different from the one in the ~/.cshrc file. The 077 umask removes all permissions from group and others.
% umask 077
% umask
77
% grep umask ~/.cshrc
umask 022
% nc run -v 0 -r unix -wl csh -c umask
----STARTING ON some-host-name----
22
----END OF LOG----
----EXIT STATUS 0----
The next example shows the umask value that is set in the ~/.cshrc file, since the csh ran that file when it started. This value overrides the value that is captured in the environment snapshot.
% nc run -v 0 -r unix -wl csh -fc umask
----STARTING ON some-host-name----
77
----END OF LOG----
----EXIT STATUS 0----
The following example shows the umask value that is set in the current shell, captured in the snapshot environment and reproduced in by vw2. That shell does not run the ~/.cshrc file because of the -f option. The snapshot file contains the following:
...
VOV_UMASK='077'
export VOV_UMASK
...
The next example shows a umask value that is different from the current shell, that was most likely inherited from the one set up in the startup script of the owner of Accelerator. It could also be set by VOV_UMASK in the startup script for the BASE environment. The BASE environment shipped by Altair does not set VOV_UMASK.
% nc run -v 0 -e BASE -r unix -wl csh -fc umask
----STARTING ON some-host-name----
22
----END OF LOG----
----EXIT STATUS 0----
The following example shows the umask value that is set by the VOV_UMASK environment variable, which is different from both the current shell, and the shell startup file.
% nc run -v 0 -e 'BASE+D(VOV_UMASK=055)' -r unix -wl csh -fc umask
----STARTING ON some-host-name----
55
----END OF LOG----
----EXIT STATUS 0----

The following example creates the logfile named by the command, and possibly the 20060713 subdirectory of vnc_logs, if it did not exist. The subdirectory is mode 0700, since it was initialized from the umask in the current shell.

The logfile itself, 162014.8525, has mode 0620 because it was initialized from the OR of umask 055 and 666 in the wrapper vw2.
% nc run -e 'BASE+D(VOV_UMASK=055)' -r unix -wl date
Resources= unix CPUS/1
Env      = BASE+D(VOV_UMASK=055)
Command  = vw date
Logfile  = vnc_logs/20060713/162014.8525
JobId    = 00424353
----STARTING ON some-host-name----
Thu Jul 13 15:57:56 PDT 2006
----END OF LOG----
----EXIT STATUS 0----
% ls -ld vnc_logs/20060713
drwx------  2 cadmgr rtda 4096 Jul 13 15:57 vnc_logs/20060713
% ls -l vnc_logs/20060713
-rw--w----  2 cadmgr rtda 29 Jul 13 15:57 vnc_logs/20060713/162014.8525