Solved

Apache Symbolic Links

Posted on 2011-09-20
5
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
sakman earned 500 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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