awk ...

If you have a server with a lot of file systems on it. Then this little “awk” command can come in useful. It can obviously be used in many other situations also.

In this example, the disk group name is /homedg/.

bash-3.00$ grep homedg /etc/vfstab
/dev/vx/dsk/homedg/sanlogs      /dev/vx/rdsk/homedg/sanlogs     /var/log/sanlogs vxfs    1       yes     -
/dev/vx/dsk/homedg/common      /dev/vx/rdsk/homedg/common     /usr/local/common vxfs    2       yes     -
bash-3.00$

bash-3.00$ awk '/homedg/{print "mount -F "$4,$1,$3}' /etc/vfstab
mount -F vxfs /dev/vx/dsk/homedg/sanlogs /var/log/sanlogs
mount -F vxfs /dev/vx/dsk/homedg/common /usr/local/common
bash-3.00$


If you run it with piping it to 'sh', then it will execute the command. You can replace the 'mount' with whatever command you like.

FORGET THE CRONTAB MAN

For some reason many admins forget the field order of the crontab file and always reference the man pages over-and-over.
Make your life easy. Just put the field definitions in your crontab file and comment (#) the lines out so the crontab file ignores it.

#minute (0-59),
#|      hour (0-23),
#|      |      day of the month (1-31),
#|      |      |      month of the year (1-12),
#|      |      |      |      day of the week (0-6 with 0=Sunday).
#|      |      |      |      |      commands
  0    2     *      *      0,4    /etc/WorkSmart.sh