Sponsored Content
Full Discussion: Context dependent symlinks
Operating Systems Linux Slackware Context dependent symlinks Post 302524086 by agentrnge on Saturday 21st of May 2011 11:21:35 AM
Old 05-21-2011
Context dependent symlinks

Ive got multiple PCs, sharing an NFS mounted home dir. For certain apps I would like to keep the config files host specific. Easy solution is to create symlinks to local folders for configs. Ideally I would still want the .config files to reside in the user home folder.

Is it possible to create a symlink with a variable in its name that where the variable is expanded when the link is traversed, rather than when the link is created.

So far my searching has resulted only in some oracle cluster specific solutions. My hosts involved are running a mix of Slackware 12 and 13 x64.

Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

search and replace symlinks

Hello All, Assuming i have a thousand symlinks under directory /mydir (and its sub-dir) such as: mysymlink1 -> ../../../myfoo/mysymlink1 mysymlink2 -> ../../../myfoo/mysymlink2 How can I search the string "myfoo" and replaced with "yourfoo" such that after the operation is complete the... (2 Replies)
Discussion started by: nixrock
2 Replies

2. Shell Programming and Scripting

Nested Symlinks?

Please don't laugh or call me a fool... I'm trying to set up a script that will go through my Music File directory and generate a set of symbolic links in a directory called "What's New". Within that directory there will be a "30 Days", "3 Months", "6 Months" and "A Year" directories. Within... (0 Replies)
Discussion started by: deckard
0 Replies

3. UNIX for Dummies Questions & Answers

Symlinks

Given a filename, is it possible to know haow many symbolic links are pointing to it? How can I tell? (1 Reply)
Discussion started by: ct1977
1 Replies

4. UNIX for Dummies Questions & Answers

tar symlinks: relative vs absolute

I create the tar file from / like so: tar cEhf name.tar usr/us And this creates the tar with the links intact. The problem is that this tar is going to be used for testing, so we want the links to point to the files in the tar. But when I extract the tar into /tmp, I get /tmp/usr/us/... as I... (2 Replies)
Discussion started by: TreeMan
2 Replies

5. Shell Programming and Scripting

Following Symlinks to Actual Script

I need to have my script know what directory it's in, even if it's run from a symlink located elsewhere. Here's what I've come up with, for the benefit of anyone with a similar need, but I'm also interested to know if there's a more elegant solution. I'd rather not get into awk-land, but I couldn't... (2 Replies)
Discussion started by: jeffclough
2 Replies

6. UNIX for Dummies Questions & Answers

Problems using RCP with symlinks. Trying to use CPIO instead

Hello, I have inherited an old Solaris box and I have to copy all of its files onto another machine, a Centos Box. The Solaris box it so ancient is does not have rsync, scp or any other useful copy functions. I tried using RCP but it handles symlinks terribly: Extraneous data is written to my... (1 Reply)
Discussion started by: mojoman
1 Replies

7. Shell Programming and Scripting

Look for, backup and delete symlinks

Hi, My first post here: Was looking if someone can help enhancing my code. I am limited to sh or ash shell (android / busybox) I made a script to look for busybox symlinks, backup them and delete them I have these questions about the below code: - busybox tar do not has the options... (2 Replies)
Discussion started by: Phil3759
2 Replies

8. Shell Programming and Scripting

Find + Symlinks = me confused

So i have read the man pages a few time. Searched google but I am not quite sure i understand all the lingo. What i want to do is list all files on / except i dont want any symlinks (because if I am searching / I will find the "true" file...correct?) So there is the -P, -H, and '-type l'... (2 Replies)
Discussion started by: nitrobass24
2 Replies

9. Shell Programming and Scripting

Rsync move with symlinks

Hi, I use rsync to move from source to target, but there are cases that I need to exclude: Suppose in my file system, I have a soft link ~/data -> /media/volgrp/data. Under data folder, there is a file hello.txt. After moving command "rsync --remove-source-files -aH --force ~/data/... (3 Replies)
Discussion started by: huangyingw
3 Replies

10. Shell Programming and Scripting

Questions related to if in awk context and if without awk context

I wrote this code, questions follow #! /bin/bash -f # Purpose - to show how if syntax is used within an awk clear; ls -l; echo "This will print out the first two columns of the inputted file in this directory"; echo "Enter filename found in this directory"; read input; ... (11 Replies)
Discussion started by: Seth
11 Replies
symlink(2)							System Calls Manual							symlink(2)

NAME
symlink - Makes a symbolic link to a file SYNOPSIS
#include <unistd.h> int symlink ( const char *path1, const char *path2 ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: symlink(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the contents of the symbolic link to create. Names the symbolic link to be created. DESCRIPTION
The symlink() function creates a symbolic link with the name specified by the path2 parameter which refers to the file named by the path1 parameter. Like a hard link (described in the link() function), a symbolic link allows a file to have multiple names. The presence of a hard link guarantees the existence of a file, even after the original name has been removed. A symbolic link provides no such assurance; in fact, the file named by the path1 parameter need not exist when the link is created. Unlike hard links, a symbolic link can cross file system boundaries. When a component of a pathname refers to a symbolic link rather than a directory, the pathname contained in the symbolic link is resolved. If the pathname in the symbolic link starts with a / (slash), the symbolic link pathname is resolved relative to the process root direc- tory. If the pathname in the symbolic link does not start with a / (slash), the symbolic link pathname is resolved relative to the direc- tory that contains the symbolic link. If the symbolic link is the last component of the original pathname, remaining components of the original pathname are appended to the con- tents of the link and pathname resolution continues. The symbolic link pathname may or may not be traversed, depending on which function is being performed. Most functions traverse the link. The functions which refer only to the symbolic link itself, rather than to the object to which the link refers, are: An error is returned if a symbolic link is named by the path2 parameter. If the file specified is a symbolic link, the status of the link itself is returned. An error is returned if a symbolic link is named as the path parameter. This call applies only to symbolic links. A symbolic link can be removed by invoking the remove() function. If the file to be renamed is a symbolic link, the symbolic link is renamed. If the new name refers to an existing symbolic link, the symbolic link is destroyed. An error is returned if a symbolic link is named as the path parame- ter. An error is returned if the symbolic link named by the path2 parameter already exists. A symbolic link can be created that refers to another symbolic link; that is, the path1 parameter can refer to a symbolic link. A symbolic link can be removed by invoking unlink(). Search access to the symbolic link is required to traverse the pathname contained therein. Normal permission checks are made on each com- ponent of the symbolic link pathname during its resolution. A Context Dependent Symbolic Link (CDSL) is a symbolic link that has a variable in the path name. The variable is resolved differently for each member system in a cluster. If the system is not a member of a cluster, the variable is resolved as if it were member0 of a cluster. See hier(5) for more information about CDSLs and the cdslinvchk(8) refernce page for information about checking the CDSL file inventory RETURN VALUES
Upon successful completion, the symlink() function returns a value of 0 (zero). If the symlink() function fails, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the symlink() function fails, errno may be set to one of the following values: The requested operation requires writing in a directory with a mode that denies write permission, or search permission is denied on a component of path2. The directory in which the entry for the symbolic link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. The path specified by the path2 parameter already exists. Too many symbolic links are found in translating path2. The length of the path1 parameter or path2 parameter exceeds PATH_MAX, or a pathname component of path2 is longer than NAME_MAX while {_POSIX_NO_TRUNC} is in effect. The path2 parameter points to a null pathname, or a component of path2 does not exist. The directory in which the entry for the symbolic link is being placed cannot be extended because there is no space left on the file system containing the directory. The new symbolic link cannot be created because there is no space left on the file system which would contain the link. There are no free inodes on the file system on which the file is being created. The operation is not applicable for this file sys- tem type. A component of path2 is not a directory. The requested operation requires writing in a directory on a read-only file system. [Tru64 UNIX] For NFS file access, if the symlink() function fails, errno may also be set to one of the following values: Indicates either that the system file table is full, or that there are too many files currently open in the system. Indicates a stale NFS file handle. An opened file was deleted by the server or another client; a client cannot open a file because the server has unmounted or unexported the remote directory; or the directory that contains an opened file was either unmounted or unexported by the server. RELATED INFORMATION
Functions: link(2), readlink(2), unlink(2) Commands: ln(1), cdslinvchk(1) Files: hier(5) Standards: standards(5) delim off symlink(2)
All times are GMT -4. The time now is 08:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy