?
Solved

Apache Symbolic Links

Posted on 2011-09-20
5
Medium Priority
?
264 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 2000 total points
ID: 36568377
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
ID: 36568408
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
ID: 36568430
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
ID: 36568456
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
ID: 36989695
thanks
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 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