Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Cleanup job to remove old files suddenly not working Post 302357380 by Scott on Tuesday 29th of September 2009 03:18:44 PM
Old 09-29-2009
Hi.

Try using the -follow option of find to "follow" symbolic links.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job not working

Hi All, I created a shell script and it works perfectly fine when I run from the command. But the same does not work as expected when I call it from a cron job. Here is the shell script(scan.sh): # # #Which directory to scan for files?... (7 Replies)
Discussion started by: janavenki
7 Replies

2. UNIX for Dummies Questions & Answers

Cron job not working

Hello, I have the following crontab entry that does not seem to be running. When I check /var/cron/log, it is not there. Here is my os info: SunOS birch 5.9 Generic_118558-09 sun4u sparc SUNW,Sun-Fire-V240 Here is the crontab entry: 01 21 * * * find /export/app/datafeed/flus/archive -mtime... (5 Replies)
Discussion started by: dkranes
5 Replies

3. Shell Programming and Scripting

performing cleanup when a job finishes

The title sounds like an easy problem (maybe it is), however, the catch is that when a job 'A' is called inside a wrapper, the execution does not wait for 'A' to finish, but it goes on to the next line (right after kicking off 'A'). My question is, how will you keep the execution waiting for... (4 Replies)
Discussion started by: ChicagoBlues
4 Replies

4. Shell Programming and Scripting

Code to remove files when corresponding file doesnt exist isnt working.

I am trying to add some code to the begging of a script so that it will remove all the .transcript files, when their is no coressponding .wav file. But it doesnt work. This is the code I have added: for transcriptfile in `$voicemaildir/*.transcript`; do wavfile=`echo $transcriptfile | cut -d'.'... (2 Replies)
Discussion started by: ghurty
2 Replies

5. Shell Programming and Scripting

cron job now working?

Hi all, I wrote a script as below, #!/bin/ksh . /app/home/etc/sudo.profile >/dev/null java -jar $HOME/abc.jar The jar file abc.jar is located in the same folder as the script. When I'm manually running that script the jar file gets executed. However if I set a cron job, it... (5 Replies)
Discussion started by: isaacniu
5 Replies

6. UNIX for Dummies Questions & Answers

Cron job not working

cron process in AIX is there when I do ps -ef |grep cron, but none of cron job is working. It appears that cron process is hanging or having some issues? How do you resolve this? Do I kill the cron process by kill -9 PID? and how to start it? Please advise. (1 Reply)
Discussion started by: Daniel Gate
1 Replies

7. Solaris

Cleanup special files create via device match in a whole root zone

I added in the configuration file of a whole root zone the following device match entries: <device match="/dev/rmt/*"/> <device match="/dev/sg/*"/> after the reboot the zone was able to see all the devices of its global zone, and let under /dev/rmt and /dev/sg the special files created with... (1 Reply)
Discussion started by: hugo_perez
1 Replies

8. UNIX for Dummies Questions & Answers

FTP batch file suddenly stopped working

Hello, we have a UNIX system the runs our business data. We have 4 users that use a particular batch command file to extract data for use in the Windows side of the fence: (despreg.bat) ftp ftp> open danapak (database name) connected to danapak ftp> user ccsb password ccsb ftp>... (29 Replies)
Discussion started by: Mick_Dundee
29 Replies

9. UNIX for Dummies Questions & Answers

Crontab job is not working

hell all: i am trying to test a crontab job for snmpwalk but it is not working: here is crontab: */1 * * * * root /root/snmpwalk.sh for the script, it is very simple: #!/usr/local/bin/bash /usr/local/bin/snmpwalk -v 2c -c public 100.10.10.10 (6 Replies)
Discussion started by: ipfreak
6 Replies

10. UNIX for Advanced & Expert Users

Backup files cleanup

Hello, I've been able to keep a certain number of backup files with the find -mtime command, but is there a way to add the last 4 Sunday's or any other day? I checked the man page and forums, but couldn't find anything. Any help would be appreciated. Thanks (8 Replies)
Discussion started by: Ramsez
8 Replies
SYMLINK(7)						     Linux Programmer's Manual							SYMLINK(7)

NAME
symlink - symbolic link handling SYMBOLIC LINK HANDLING
Symbolic links are files that act as pointers to other files. To understand their behavior, you must first understand how hard links work. A hard link to a file is indistinguishable from the original file because it is a reference to the object underlying the original filename. (To be precise: each of the hard links to a file is a reference to the same i-node number, where an i-node number is an index into the i- node table, which contains metadata about all files on a file system. See stat(2).) Changes to a file are independent of the name used to reference the file. Hard links may not refer to directories (to prevent the possibility of loops within the file system tree, which would confuse many programs) and may not refer to files on different file systems (because i-node numbers are not unique across file systems). A symbolic link is a special type of file whose contents are a string that is the pathname another file, the file to which the link refers. In other words, a symbolic link is a pointer to another name, and not to an underlying object. For this reason, symbolic links may refer to directories and may cross file system boundaries. There is no requirement that the pathname referred to by a symbolic link should exist. A symbolic link that refers to a pathname that does not exist is said to be a dangling link. Because a symbolic link and its referenced object coexist in the file system name space, confusion can arise in distinguishing between the link itself and the referenced object. On historical systems, commands and system calls adopted their own link-following conventions in a somewhat ad-hoc fashion. Rules for a more uniform approach, as they are implemented on Linux and other systems, are outlined here. It is important that site-local applications also conform to these rules, so that the user interface can be as consistent as possible. Symbolic link ownership, permissions, and timestamps The owner and group of an existing symbolic link can be changed using lchown(2). The only time that the ownership of a symbolic link mat- ters is when the link is being removed or renamed in a directory that has the sticky bit set (see stat(2)). The last access and last modification timestamps of a symbolic link can be changed using utimensat(2) or lutimes(3). On Linux, the permissions of a symbolic link are not used in any operations; the permissions are always 0777 (read, write, and execute for all user categories), and can't be changed. Handling of symbolic links by system calls and commands Symbolic links are handled either by operating on the link itself, or by operating on the object referred to by the link. In the latter case, an application or system call is said to follow the link. Symbolic links may refer to other symbolic links, in which case the links are dereferenced until an object that is not a symbolic link is found, a symbolic link that refers to a file which does not exist is found, or a loop is detected. (Loop detection is done by placing an upper limit on the number of links that may be followed, and an error results if this limit is exceeded.) There are three separate areas that need to be discussed. They are as follows: 1. Symbolic links used as filename arguments for system calls. 2. Symbolic links specified as command-line arguments to utilities that are not traversing a file tree. 3. Symbolic links encountered by utilities that are traversing a file tree (either specified on the command line or encountered as part of the file hierarchy walk). System calls The first area is symbolic links used as filename arguments for system calls. Except as noted below, all system calls follow symbolic links. For example, if there were a symbolic link slink which pointed to a file named afile, the system call open("slink" ...) would return a file descriptor referring to the file afile. Various system calls do not follow links, and operate on the symbolic link itself. They are: lchown(2), lgetxattr(2), llistxattr(2), lre- movexattr(2), lsetxattr(2), lstat(2), readlink(2), rename(2), rmdir(2), and unlink(2). Certain other system calls optionally follow sym- bolic links. They are: faccessat(2), fchownat(2), fstatat(2), linkat(2), open(2), openat(2), and utimensat(2); see their manual pages for details. Because remove(3) is an alias for unlink(2), that library function also does not follow symbolic links. When rmdir(2) is applied to a symbolic link, it fails with the error ENOTDIR. The link(2) warrants special discussion. POSIX.1-2001 specifies that link(2) should dereference oldpath if it is a symbolic link. However, Linux does not do this. (By default Solaris is the same, but the POSIX.1-2001 specified behavior can be obtained with suitable compiler options.) The upcoming POSIX.1 revision changes the specification to allow either behavior in an implementation. Commands not traversing a file tree The second area is symbolic links, specified as command-line filename arguments, to commands which are not traversing a file tree. Except as noted below, commands follow symbolic links named as command-line arguments. For example, if there were a symbolic link slink which pointed to a file named afile, the command cat slink would display the contents of the file afile. It is important to realize that this rule includes commands which may optionally traverse file trees, e.g., the command chown file is included in this rule, while the command chown -R file, which performs a tree traversal, is not. (The latter is described in the third area, below.) If it is explicitly intended that the command operate on the symbolic link instead of following the symbolic link, e.g., it is desired that chown slink change the ownership of the file that slink is, whether it is a symbolic link or not, the -h option should be used. In the above example, chown root slink would change the ownership of the file referred to by slink, while chown -h root slink would change the ownership of slink itself. There are some exceptions to this rule: * The mv(1) and rm(1) commands do not follow symbolic links named as arguments, but respectively attempt to rename and delete them. (Note, if the symbolic link references a file via a relative path, moving it to another directory may very well cause it to stop working, since the path may no longer be correct.) * The ls(1) command is also an exception to this rule. For compatibility with historic systems (when ls(1) is not doing a tree walk, i.e., the -R option is not specified), the ls(1) command follows symbolic links named as arguments if the -H or -L option is specified, or if the -F, -d, or -l options are not specified. (The ls(1) command is the only command where the -H and -L options affect its behavior even though it is not doing a walk of a file tree.) * The file(1) command is also an exception to this rule. The file(1) command does not follow symbolic links named as argument by default. The file(1) command does follow symbolic links named as argument if the -L option is specified. Commands traversing a file tree The following commands either optionally or always traverse file trees: chgrp(1), chmod(1), chown(1), cp(1), du(1), find(1), ls(1), pax(1), rm(1), and tar(1). It is important to realize that the following rules apply equally to symbolic links encountered during the file tree traversal and symbolic links listed as command-line arguments. The first rule applies to symbolic links that reference files other than directories. Operations that apply to symbolic links are per- formed on the links themselves, but otherwise the links are ignored. The command rm -r slink directory will remove slink, as well as any symbolic links encountered in the tree traversal of directory, because symbolic links may be removed. In no case will rm(1) affect the file referred to by slink. The second rule applies to symbolic links that refer to directories. Symbolic links that refer to directories are never followed by default. This is often referred to as a "physical" walk, as opposed to a "logical" walk (where symbolic links the refer to directories are followed). Certain conventions are (should be) followed as consistently as possible by commands that perform file tree walks: * A command can be made to follow any symbolic links named on the command line, regardless of the type of file they reference, by specify- ing the -H (for "half-logical") flag. This flag is intended to make the command-line name space look like the logical name space. (Note, for commands that do not always do file tree traversals, the -H flag will be ignored if the -R flag is not also specified.) For example, the command chown -HR user slink will traverse the file hierarchy rooted in the file pointed to by slink. Note, the -H is not the same as the previously discussed -h flag. The -H flag causes symbolic links specified on the command line to be dereferenced for the purposes of both the action to be performed and the tree walk, and it is as if the user had specified the name of the file to which the symbolic link pointed. * A command can be made to follow any symbolic links named on the command line, as well as any symbolic links encountered during the tra- versal, regardless of the type of file they reference, by specifying the -L (for "logical") flag. This flag is intended to make the entire name space look like the logical name space. (Note, for commands that do not always do file tree traversals, the -L flag will be ignored if the -R flag is not also specified.) For example, the command chown -LR user slink will change the owner of the file referred to by slink. If slink refers to a directory, chown will traverse the file hierarchy rooted in the directory that it references. In addition, if any symbolic links are encountered in any file tree that chown traverses, they will be treated in the same fashion as slink. * A command can be made to provide the default behavior by specifying the -P (for "physical") flag. This flag is intended to make the entire name space look like the physical name space. For commands that do not by default do file tree traversals, the -H, -L, and -P flags are ignored if the -R flag is not also specified. In addition, you may specify the -H, -L, and -P options more than once; the last one specified determines the command's behavior. This is intended to permit you to alias commands to behave one way or the other, and then override that behavior on the command line. The ls(1) and rm(1) commands have exceptions to these rules: * The rm(1) command operates on the symbolic link, and not the file it references, and therefore never follows a symbolic link. The rm(1) command does not support the -H, -L, or -P options. * To maintain compatibility with historic systems, the ls(1) command acts a little differently. If you do not specify the -F, -d or -l options, ls(1) will follow symbolic links specified on the command line. If the -L flag is specified, ls(1) follows all symbolic links, regardless of their type, whether specified on the command line or encountered in the tree walk. SEE ALSO
chgrp(1), chmod(1), find(1), ln(1), ls(1), mv(1), rm(1), lchown(2), link(2), lstat(2), readlink(2), rename(2), symlink(2), unlink(2), uti- mensat(2), lutimes(3), path_resolution(7) COLOPHON
This page is part of release 3.53 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 2008-06-18 SYMLINK(7)
All times are GMT -4. The time now is 11:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy