Creating symbolic links

From HelioHost Wiki
Jump to: navigation, search

To create a symbolic link in cPanel, create and run a one-time cron job with the following command:

ln -s /path/to/target/directory /path/to/shortcut >/dev/null 2>&1

There isn't a 'run once' option for cron jobs, so set it to run every minute. Wait 1 minute after setting it, then check if the link was created. Be sure to delete the cron job after so you don't exceed the two cron jobs per user per day limit! The cron jobs utility may be found under the Advanced section of cPanel.

For further information please see this thread

Here is an example for deploying a Ruby on Rails application:

ln -s /home/username/app_name/public /home/username/public_html/app_name >/dev/null 2>&1

Replace username and app_name with your info.

Also, there is another way by using PHP. Create a file, name it something like "symlink.php', and put the following in the file:

$rails_public = "/home/username/app_name/public";
$public_html = "/home/username/public_html/app_name";
$symlink = symlink($rails_public,$public_html);
if (!$symlink)
die("Creating link failed. Check your error_log.");
echo "Link created successfully!";
echo readlink($public_html);

Again, replace username and app_name with your info. Put this file somewhere in your "public_html" directory, and then load the file/page in a browser. If you see the message, you are done.

Personal tools

Google AdSense