Skip to content

Partially Modify File

hilmiller edited this page Nov 14, 2014 · 3 revisions

You can only "append" to an existing file in LosF, you can't dynamically modify a file anyplace. For example, to add a line to the end of the fstab file while keeping the original fstab entries intact.

First create the file

# vim /admin/losf/config/const_files/clustername/login/fstab

That file should only contain the contents you would like to append.

master.clustername.tacc.utexas.edu:/admin /admin nfs     defaults        0 0

In /admin/losf/config/config.clustername, configure LosF to append the file.

[PartialConfigFiles]

/etc/fstab      = partial

Now run update on the host where the changes should be applied

[root@login3 losf]# ./update
** Config dir -> /admin/losf/config
** Checking on OS packages to remove (clustername:login)
** Checking on Custom packages to remove (clustername:login)
** Syncing OS packages (clustername:login)
** Syncing Custom packages (clustername:login)
** Syncing configuration files (clustername:login)
   --> UPDATING: [hosts] Differences found: requires syncing
Creating /tmp/losf directory to store orig file during syncing
       --> Copy of original file saved at /tmp/losf/hosts.orig
      --> [hosts] Sync successful
** Syncing partial file contents (clustername:login)
   --> INFO: Adding partial sync delimiter to file /etc/fstab
   --> UPDATING: [fstab] Differences found: fstab requires partial syncing
       --> Copy of original file saved at /tmp/losf/fstab.orig
   --> [fstab] Sync successful
** Syncing non-existence of configuration files (clustername:login)
** Syncing soft links (clustername:login)
** Syncing runlevel services (clustername:login)
** Syncing file/directory permissions (clustername:login)

UPDATED: [RPMs: OS     0/0  Custom     0/0] [Files:    2/1] [Links:   0/0] [Services:   0/0] [Perms:   0/0] -> login

Now this original file


#
# /etc/fstab
# Created by anaconda on Thu Nov 13 08:58:31 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=beb6b3c9-3a23-4ce2-bbb3-d59446b5ac6b /                       ext3    defaults        1 1
UUID=909e6fad-8092-4704-bb2d-39db74c71740 /tmp                    ext3    defaults        1 2
UUID=232bc118-dade-42a8-820b-36a9e2c16f17 /var                    ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0

Will change to this file


#
# /etc/fstab
# Created by anaconda on Thu Nov 13 08:58:31 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=beb6b3c9-3a23-4ce2-bbb3-d59446b5ac6b /                       ext3    defaults        1 1
UUID=909e6fad-8092-4704-bb2d-39db74c71740 /tmp                    ext3    defaults        1 2
UUID=232bc118-dade-42a8-820b-36a9e2c16f17 /var                    ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
#--------------------------------------------------------------begin-sync-losf-
#
# LosF Partially synced file - please do not edit entries between the begin/end
# sync delimiters or you may lose the contents during the next synchronization 
# process. Knock yourself out adding customizations to the rest of the file as 
# anything outside of the delimited section will be preserved.
#
master.clustername.tacc.utexas.edu:/admin /admin nfs     defaults        0 0
#----------------------------------------------------------------end-sync-losf-