Sponsored Content
Full Discussion: Creating conditional symlink
Operating Systems Linux Ubuntu Creating conditional symlink Post 302806771 by skiwi on Monday 13th of May 2013 03:58:27 PM
Old 05-13-2013
Reference conditional symlinks

Hi, I am wondering if there is a way to create 'conditional symlinks' on a GNU/linux or unix system. I know this has been brought up already several times.. (I wanted to put some links but I dont have 5 posts yet..)

From wikipedia
Quote:
Pyramid Technology's OSx implemented conditional symbolic links which pointed to different locations depending on which universe a program was running in.
However I haven't seen any solutions.

I have the "feeling" that it could perhaps be done by creating a special device (like in /dev). However I have no experience creating such devices. For example a small C-program could act as wrapper processing the conditionals, working as pipe stream. For example based on the hostname the stream would point to either file1 or file2, of course more complicated operations are easily possible if this basic example works.

Could someone comment if my hunch makes any sense?

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a script using the case conditional

hello, i am a newbie who is just starting to use liunx, and I need to accept a string from the terminal and use case to echo a suitable message if the string doesn't have at least 10 characters. Also, how would I do the same thing using expr? (3 Replies)
Discussion started by: soccerstr1
3 Replies

2. UNIX for Dummies Questions & Answers

creating conditional logs

Hi all, I am new to scripting and hope to get help in this forum...we use autosys ... the jil files call shell scripts (korn shell) for automated processes and create logs everytime they are run...the process runs every 5 mins which is creating huge logs...i need to know if logs be created... (0 Replies)
Discussion started by: sonali007
0 Replies

3. UNIX for Dummies Questions & Answers

creating symlink

hi... I have a folder<abc> under /root folder. I want to create a symlink such that when i click on folder<abc> under root, should display my home folder (home/krish). Immediate inputs appreciated..... (1 Reply)
Discussion started by: rama.honge
1 Replies

4. Shell Programming and Scripting

sed -i destroy symlink - how to solve this ?

After a few hours of frustration because I didn't understand why my symlinks are destroyed i just found out that sed -i will destroy symlinks. I searched but i didn't found any good solution for this. Is there any way to overcome this ? On my ubuntu server sed version is 4.1.5 edit: Sorry... (0 Replies)
Discussion started by: ktm
0 Replies

5. Solaris

symlink on link file

Hi all, I want to create a symlink on a link file, i mean, there is a file which is actually a symlink of some version. Now i want to create one more symlink on that link file. EX: there is a file: uat -> version prod -> version Now i want to create one more link on these 'uat' and... (1 Reply)
Discussion started by: raghu.iv85
1 Replies

6. Shell Programming and Scripting

ln -s creates symlink in symlink, if [ -f ... ] says file that exists doesn't exist

Hi Forums, I got a little problem, I made a few modifications to the code of the launch script of a testing server(minecraft) and now updating is broken aswell as the automatic directory creation. These Lines somehow create an endless symlink that refers to itself and I don't know how to fix... (0 Replies)
Discussion started by: Xaymar
0 Replies

7. UNIX for Dummies Questions & Answers

Remove symlink and target

i would like to remove a directory and also symlink target inside. my_directory -- file1 -> /targetpath/file1 -- file2 -> /targetpath/file2 rm -rf my_directory will not remove symlink target. rm -rf "`readlink -f file1`" will only remove target if specifying the symlink is specified ... (4 Replies)
Discussion started by: lsy
4 Replies

8. Shell Programming and Scripting

Symlink creation

I am trying to setup my plex server to use symlinks rather than host the movie files. in my storage directory, i have both movies(some in subdirectory of the name and some just in the parent directory) and tvshows, which have subdirectories for each season, which contains the episodes i would... (3 Replies)
Discussion started by: bandion
3 Replies

9. UNIX for Beginners Questions & Answers

Symlink

I know how to create a symlink but I am getting an error message that the file already exists. Also, my symlink doesn't point from target directory to the path correctly, Here is an example of the path to my folder structure path: cd /wkspce/wff/DEV/jobs/DEL the folder structure is: ... (3 Replies)
Discussion started by: dellanicholson
3 Replies

10. Shell Programming and Scripting

How to create symlink for latest file only?

Hello, On Solaris 10, here are entries for logs in httpd.conf ErrorLog "|/export/apache/apache-2.2.17/bin/rotatelogs -l -f /var/log/apache/error_log.%Y%m%d 86400" It keeps creating daily logs with below names - -rw-r--r-- 1 root root 1016747232 Apr 5 23:59... (16 Replies)
Discussion started by: solaris_1977
16 Replies
SYMLINKAT(2)						     Linux Programmer's Manual						      SYMLINKAT(2)

NAME
symlinkat - create a symbolic link relative to a directory file descriptor SYNOPSIS
#include <fcntl.h> /* Definition of AT_* constants */ #include <stdio.h> int symlinkat(const char *oldpath, int newdirfd, const char *newpath); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): symlinkat(): Since glibc 2.10: _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L Before glibc 2.10: _ATFILE_SOURCE DESCRIPTION
The symlinkat() system call operates in exactly the same way as symlink(2), except for the differences described in this manual page. If the pathname given in newpath is relative, then it is interpreted relative to the directory referred to by the file descriptor newdirfd (rather than relative to the current working directory of the calling process, as is done by symlink(2) for a relative pathname). If newpath is relative and newdirfd is the special value AT_FDCWD, then newpath is interpreted relative to the current working directory of the calling process (like symlink(2)). If newpath is absolute, then newdirfd is ignored. RETURN VALUE
On success, symlinkat() returns 0. On error, -1 is returned and errno is set to indicate the error. ERRORS
The same errors that occur for symlink(2) can also occur for symlinkat(). The following additional errors can occur for symlinkat(): EBADF newdirfd is not a valid file descriptor. ENOTDIR newpath is relative and newdirfd is a file descriptor referring to a file other than a directory. VERSIONS
symlinkat() was added to Linux in kernel 2.6.16. CONFORMING TO
POSIX.1-2008. NOTES
See openat(2) for an explanation of the need for symlinkat(). SEE ALSO
openat(2), symlink(2), path_resolution(7), symlink(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-12-13 SYMLINKAT(2)
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy