[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] File link problem



On Sat, 19 May 2001, Andy wrote:

> I have cocked up my server again while  setting up rsync. I accidentally
> deleted the tmp directory. So postgress died. I have created a tmp
> directory in the root so it is working at the moment, but it should be
> in home and a link to the root directory.
> How do I create this directory and link correctly. I have no idea how to
> create links so step by step would help.

The like from /tmp to /home/tmp is create via the 'ln' command.  Details
on 'ln' can be obtained by running 'man ln'.  The /tmp link us created with
the -s option to 'ln'.

Here is a bash script that recreates the synlinks for tmp:

WARNING - This will remove any contents in /usr/tmp, /tmp, and /var/tmp.
If you want anything in there, move it to /home/tmp first.

---cut here---
#!/bin/bash

# Make sure we have a /home/tmp to symlink:
if [ ! -d /home/tmp ]; then
	mkdir /home/tmp
	chown root.root /home/tmp
	chmod 1777 /home/tmp
fi 

# Symlink the three tmp dirs:
if [ -d /tmp ]; then
	rm -rf /tmp
	ln -s /home/tmp /tmp
fi

if [ -d /usr/tmp ]; then
	rm -rf /usr/tmp
	ln -s /home/tmp /usr/tmp
fi

if [ -d /var/tmp ]; then
	rm -rf /var/tmp
	ln -s /home/tmp /var/tmp
fi
--cut here again--

Save this, make it executable, and run it. :)

Jeff
-- 
Jeff Lovell
Sun Microsystems