Solved

Apache Symbolic Links

Posted on 2011-09-20
5
251 Views
Last Modified: 2012-05-12
Hello,

I am going to install magento on a Added domain and I need to add these symbolic links:

ln -s ../public_html/app ./app
ln -s ../public_html/errors ./errors
ln -s ../public_html/includes ./includes
ln -s ../public_html/js ./js
ln -s ../public_html/lib ./lib
ln -s ../public_html/media ./media
ln -s ../public_html/skin ./skin
ln -s ../public_html/var ./var

If adding these creates a problem with the current site I would like to know how to remove them quickly.

What would the shell command be to 'undo' these?

Thank you for your help,
Matt
0
Comment
Question by:movieprodw
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
sakman earned 500 total points
Comment Utility
The symbolic linked directories can just be deleted without affecting the original directory.  The symbolic links are files, not directories, so you use "rm".

To be safe, you can verify the file is a link using the "-h" in a test statement.

You can remove all symbolic links in a directory using a short "for" loop.   To test it, I would use "echo" instead of "rm" first, then re-run it with "rm":

$ for file in `ls -1 ../public_html/`
> do
> if [ -h $file ]; then
>     echo "$file"
> fi
> done

Open in new window

0
 
LVL 4

Expert Comment

by:sakman
Comment Utility
To clarify, you want to delete the links in the directory they reside.   My example above is misleading because I was listing the files in public_html.

You would want to whatever directory you have the links (app, errors, etc).

If there are only links there you could just remove them all.  Or if you want to loop over mixed files and links, you could run a for loop as above, but first CD into the directory with the links and then `ls -1`
0
 
LVL 1

Author Comment

by:movieprodw
Comment Utility
Okay so I can use shell and enter:

cd folder_name/
ln -s ../public_html/app ./app
ln -s ../public_html/errors ./errors
ln -s ../public_html/includes ./includes
ln -s ../public_html/js ./js
ln -s ../public_html/lib ./lib
ln -s ../public_html/media ./media
ln -s ../public_html/skin ./skin
ln -s ../public_html/var ./var

to create and

cd folder_name/
rm -s ../public_html/app ./app
rm -s ../public_html/errors ./errors
rm -s ../public_html/includes ./includes
rm -s ../public_html/js ./js
rm -s ../public_html/lib ./lib
rm -s ../public_html/media ./media
rm -s ../public_html/skin ./skin
rm -s ../public_html/var ./var

to remove?
0
 
LVL 4

Expert Comment

by:sakman
Comment Utility
Nope.

Just cd into the folder that has the links and remove them:
rm app errors include js ....

You can use ls -l to see that they are links.

The "for" loop in my example was only if you had a bunch of other files in that directory.
0
 
LVL 1

Author Closing Comment

by:movieprodw
Comment Utility
thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now