Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynmaic symbolic link?

0 views
Skip to first unread message

Fabio Giannotti

unread,
Oct 1, 2001, 3:06:55 PM10/1/01
to sco...@xenitec.on.ca

SCO 5.0.5 or better:

Can you have a dynamic symbolic link to a file?

Here is the scenario. I have a program that generates daily reports (just
past midnight) and the name of the report has the date in it. For example:
/u/prog/data/rep20010912.txt
is the report generated for Sep 12, 2001. I would like to have a file
called "rep_today.txt" that is dynamically linked to the current days
report.

Now,
ln -s /u/prog/data/rep`date=%Y%m%d`.txt rep_today.txt
works, but it is a one shot deal. That is, the link is created when I type
the command,but is never updated.

So, is this possible to do? (I know how to do it w/a cron job, but there
are other instances I'd like to do this that don't involve time/date
dependent files...)

Thanks,
Fabio


Jean-Pierre Radley

unread,
Oct 1, 2001, 4:44:00 PM10/1/01
to ScoMisc [c.u.s.m]
Fabio Giannotti propounded (on Mon, Oct 01, 2001 at 07:06:55PM +0000):

If you know how to do it with a cron job, why can't you do it in a
script?

--
JP

Fabio Giannotti

unread,
Oct 1, 2001, 5:01:12 PM10/1/01
to sco...@xenitec.on.ca

I'm sorry, I guess I did not make myself clear.

I would like to know if the link itself can be dynamic. That is, is there a
way to "embed" the commands within the link so that the link changes by
itself every day. (I'm guessing the answer is "no", but I was hoping...)

Fabio

Jean-Pierre Radley

unread,
Oct 1, 2001, 6:54:11 PM10/1/01
to ScoMisc [c.u.s.m]
Fabio Giannotti propounded (on Mon, Oct 01, 2001 at 09:01:12PM +0000):

|
| I'm sorry, I guess I did not make myself clear.
|
| I would like to know if the link itself can be dynamic. That is, is there a
| way to "embed" the commands within the link so that the link changes by
| itself every day. (I'm guessing the answer is "no", but I was hoping...)

No. Just set up a cron job to do it.
--
JP

Richard Howlett

unread,
Oct 1, 2001, 7:01:23 PM10/1/01
to

I don't think you can do what you are trying to do. You have 2 choices:
1. add the ln command to the end of the script that runs the reports
or
2. write another script containing an ln command that is run after the
reports having allowed enough time for them to finish.

Also you will need the "force" flag in the ln command. "man ln" for more
details.

--
Richard Howlett

mailto:ric...@howie.org.uk

Tony Lawrence

unread,
Oct 2, 2001, 6:40:29 AM10/2/01
to
Fabio Giannotti wrote:

> I'm sorry, I guess I did not make myself clear.
>
> I would like to know if the link itself can be dynamic. That is, is there a
> way to "embed" the commands within the link so that the link changes by
> itself every day. (I'm guessing the answer is "no", but I was hoping...)


No. A symbolic link is just the path name of the file it points to and
a bit set that tells the OS to follow that path. That's all it is (look
at one with fsdb if you don't follow this).


--
Tony Lawrence
SCO/Linux Support Tips, How-To's, Tests and more: http://pcunix.com

steve overy

unread,
Oct 2, 2001, 8:12:48 AM10/2/01
to
Richard Howlett <ric...@nospam.demon.co.uk> wrote in message news:<3BB8F5C3...@nospam.demon.co.uk>...

maybe a script that:
DATE=`date...`
ln file_name${DATE} target
view target

steve

Bill Vermillion

unread,
Oct 2, 2001, 12:12:23 PM10/2/01
to
In article <00b201c14aac$3d5b2ba0$6700...@venmar.com>,
Fabio Giannotti <fab...@venmar.com> wrote:

>SCO 5.0.5 or better:

>Can you have a dynamic symbolic link to a file?

As others said - no - because a sym link is just a text file
pointing to a real file name.

>Here is the scenario. I have a program that generates daily reports
>(just past midnight) and the name of the report has the date in it.
>For example:

> /u/prog/data/rep20010912.txt

>is the report generated for Sep 12, 2001. I would like to have a file
>called "rep_today.txt" that is dynamically linked to the current days
>report.

>Now,

> ln -s /u/prog/data/rep`date=%Y%m%d`.txt rep_today.txt works, but
>it is a one shot deal. That is, the link is created when I type the
>command,but is never updated.

Because the time stamp in the file name I'm assuming that these
are being kept for archival and the link is for easy viewing of
today's report.

Depending on how big the report is, and this is not efficient,
can the program that generates the report just write to a tee
so that the file with todays' date gets copied to a file
called rep_today.txt at the same time. Crude - but if the file is
small the overhead might not be much more than a symlink.

--
Bill Vermillion - bv @ wjv . com

Tony Lawrence

unread,
Oct 3, 2001, 7:25:33 AM10/3/01
to
Bill Vermillion wrote:
>
> In article <00b201c14aac$3d5b2ba0$6700...@venmar.com>,
> Fabio Giannotti <fab...@venmar.com> wrote:
>
> >SCO 5.0.5 or better:
>
> >Can you have a dynamic symbolic link to a file?
>
> As others said - no - because a sym link is just a text file
> pointing to a real file name.


Well, not exactly a text file. The path text is stored in the inode.

Bill Vermillion

unread,
Oct 3, 2001, 12:00:58 PM10/3/01
to
In article <3BBAF5E1...@pcunix.com>,

Tony Lawrence <to...@pcunix.com> wrote:
>Bill Vermillion wrote:
>>
>> In article <00b201c14aac$3d5b2ba0$6700...@venmar.com>,
>> Fabio Giannotti <fab...@venmar.com> wrote:
>>
>> >SCO 5.0.5 or better:
>>
>> >Can you have a dynamic symbolic link to a file?
>>
>> As others said - no - because a sym link is just a text file
>> pointing to a real file name.

>Well, not exactly a text file. The path text is stored in the inode.

That's the way it used to be, but storing it in the inode was a
good move.

Bela Lubkin

unread,
Oct 3, 2001, 7:23:54 PM10/3/01
to sco...@xenitec.on.ca
Tony Lawrence wrote:

> Bill Vermillion wrote:
> >
> > In article <00b201c14aac$3d5b2ba0$6700...@venmar.com>,
> > Fabio Giannotti <fab...@venmar.com> wrote:
> >
> > >SCO 5.0.5 or better:
> >
> > >Can you have a dynamic symbolic link to a file?
> >
> > As others said - no - because a sym link is just a text file
> > pointing to a real file name.
>
> Well, not exactly a text file. The path text is stored in the inode.

Well, not exactly either. That's filesystem-specific. HTFS (the most
common filesystem on OpenServer) stores symbolic links of up to 52 bytes
in the inode. Longer symlinks still get written into a filesystem
block. EAFS/S51K filesystems do not write symlinks into the inode. I
don't know about DTFS; nor about other Caldera or non-Caldera OSes...

>Bela<

Stephen M. Dunn

unread,
Oct 5, 2001, 6:51:36 PM10/5/01
to
In article <2001100316...@mammoth.ca.caldera.com> Bela Lubkin <be...@caldera.com> writes:
$Well, not exactly either. That's filesystem-specific. HTFS (the most
$common filesystem on OpenServer) stores symbolic links of up to 52 bytes
$in the inode. Longer symlinks still get written into a filesystem
$block. EAFS/S51K filesystems do not write symlinks into the inode. I
$don't know about DTFS; nor about other Caldera or non-Caldera OSes...

DTFS has a similar in-inode symlink facility to that of HTFS, though
I don't recall the length limitation off the top of my head.
--
Stephen M. Dunn <ste...@stevedunn.ca>
>>>----------------> http://www.stevedunn.ca/ <----------------<<<
------------------------------------------------------------------
Say hi to my cat -- http://www.stevedunn.ca/photos/toby/

Bela Lubkin

unread,
Oct 5, 2001, 9:08:53 PM10/5/01
to sco...@xenitec.on.ca
Stephen M. Dunn wrote:

> In article <2001100316...@mammoth.ca.caldera.com> Bela Lubkin <be...@caldera.com> writes:
> $Well, not exactly either. That's filesystem-specific. HTFS (the most
> $common filesystem on OpenServer) stores symbolic links of up to 52 bytes
> $in the inode. Longer symlinks still get written into a filesystem
> $block. EAFS/S51K filesystems do not write symlinks into the inode. I
> $don't know about DTFS; nor about other Caldera or non-Caldera OSes...
>
> DTFS has a similar in-inode symlink facility to that of HTFS, though
> I don't recall the length limitation off the top of my head.

Looks like it's 192. So "most reasonable" symlinks should fit in a DTFS
inode. Some of the SSO symlinks shipped with OSR5 don't fit into the
HTFS 52-byte limit, though a pretty good majority of them do. (Well, on
my test system I see 5075 /opt/K and /var/opt/K symlinks <= 52 bytes,
3828 > 52, or 57% fit within the inode; not counting SkunkWare stuff,
which comes in at 249 & 637 or 28%.)

>Bela<

Frank J. Hajek

unread,
Oct 15, 2001, 11:05:17 AM10/15/01
to
Two suggestions:
1. Use full path names for BOTH files with the ls -s command; and
2. Remote the old link prior to creating a new one.
fjhajek.vcf

Frank J. Hajek

unread,
Oct 15, 2001, 3:24:15 PM10/15/01
to
Oooops... Make that ln -s command!
fjhajek.vcf
0 new messages