Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Cool symlink hack

by blazar (Canon)
on Nov 17, 2005 at 12:52 UTC ( #509387=note: print w/ replies, xml ) Need Help??


in reply to Cool symlink hack

Hmmm... I would call this a ehm... "cool symlink hack"!! Just an idea though: You may use an actual, existing, file as a target if the system is down for maintenance. So you can put relevant time info in its atime and/or mtime by means of utime. E.g.:

for (my $target=readlink $file) { if (-f) { warn "System is down for maintenance!\n", "Expected to become available again at ", scalar localtime +(stat _)[8], "\n"; } else { print "IP address: $_\n"; } }

Of course this is oversimplified and you would put all sorts of checks you think to be appropriate!

All in all the technique is somewhat awkward in that you use file existence to signal failure. But you're already using a "hanging symlink" to carry info, so...


Comment on Re: Cool symlink hack
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://509387]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2014-12-27 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls