When I run the configure script to build GNU global on Linux system, I got the message "cannot create temp file for here document: No space left on device". Indeed, / disk was full.
So I tried to change temporary directory to another disk, and I set the environment variable TMPDIR, TMP, and TEMP to another disk directory, say /mnt/tmp.
I retried to run configure script, but I got the same message. What's wrong? Please give me any advice.
Thanks.
you could add the below statement at the beginning of your script.
export TMPDIR='DIRNAME'
where "DIRNAME" is any directory on which you have full permissions and has sufficient memory available in it
you can override the location of the temporary directory during configure like so:
./configure TMPDIR=path/to/your/tmp/folder
If your / directory is full, and the program is trying to write to your /tmp directory, try renaming the tmp directory to something like tmp_old, then create a symbolic link to your new tmp folder like: ln -s /mnt/tmp /tmp
Related
I'm trying to solve bandit24 on overthe wire on ubuntu virtual machine.
I have already seen the solution.
But i have a problem,when i try to create a directory on tmp as bandit24#bandit i get this message:
Cannot create directory "name_of_directory": file exists.
If I try with find command there is only the "." directory and with ls I get the message:
Cannot open directory '.' : permission denied.
I also have tried with ls -l on tmp and I get the message:
Cannot open directory 'tmp': Permission denied
What else could I do?
What could be the problem?
Try to prepend sudo at your command. Seems you don't have permissions to read the /tmp directory, what is pretty weird.
Example that might works:
To list the /tmp contents:
sudo ls -l /tmp
To create the 'my_new_dir' inside /tmp:
sudo mkdir /tmp/my_new_dir
It means that there is a directory under /tmp/ with the same name that you specified. But since you did not create it (in this case, someone created with a different bandit user), you cannot view it. There is not read permission for bandit24 to access it.
Since /tmp/ is directory accessible for all user accounts, you cannot list the files/directories under it without the root permission. (Which means the root of the bandit machine has configured like that)
What you need to do
Try a random name. Create anything random under /tmp/. It will work.
I have a bash script which i want to call from any directory, but i don't want to add the directory it is in to PATH as it is filled with lots of other scripts which will just clutter.
The script in question manipulates environment variables, so i have to source it.
I tried creating an alias
alias aliastoscript="/path/to/script"
source aliastoscript #This does not work says no such file
I also can't copy the script itself to a different location as it depends on the directory structure and other scripts in the directory.
So i tried a symlink to a location already in path:
ln -s /path/to/script /directory/already/in/path/myscript
But this does not work either:
source myscript #says no such file exists
Can anyone suggest how i achieve this? And why does the symlink approach not work?
If it makes any difference, i am using a zsh shell on ubuntu 14.04
EDIT:
The answer given below works, but i also wanted to know why the symlink approach was not working.
Here is the sequence of commands
ln -s /path/to/script /directory/already/in/path/myscript
#Now there is a symlink called myscript in a directory which is in PATH
source myscript arg1 #This throws an error saying no such file myscript,
#but it is not supposed to happen because myscript resides in a directory which is in PATH
EDIT 2:
I just figured what i was doing wrong, the symlink i created, i had used relative paths, totally stupid of me, using absolute paths it worked like a charm.
Try replacing:
alias aliastoscript="/path/to/script"
with:
export aliastoscript="/path/to/script"
You have a $ missing in front of the variable name.
source $aliastoscript
You do not need soft link for the source. The complete file name should work. Better is
source /path/to/script
I changed path of temporary folder from /tmp to a new path. I made these changes in /etc/environment file. I added following lines.
TEMP="path to new folder"
TMPDIR="path to new folder"
But still /tmp folder is being used as temporary folder.
The reason I want to change the path is because size of /tmp volume is very less.
Any reason why changes wouldn't be reflected? Do I need to reboot the server?
You should probably put a symlink to the new directory if possible as so many apps and system processes are likely still looking for it.
ln -s /path/to/new/tmp /tmp
In my production server, somebody executed rm -rf and my important files are removed permanently. So, I thought of having a recycle bin, so if a user do rmthe file will move to RecycleBin rather than deleting from server. And i've made the below script for it. But I'm getting some error while it executed.
alias rm='/root/remove.sh'
#rm test_file
Now below script will trigger when you type the rm command
#!/bin/bash
dir=$(pwd)
mv $dir/$1 /root/Recyclebin
when the above script is triggered i'm getting the following error.
mv:cannot move '/root/test_file' to '/root/Recyclebin': Not a directory
Now, please suggest is there anyother way to make a recycle bin concept other than this or please help to resolve the error. Thanks in advance.
I'm using CentOS 5.6
Try This
At first create a folder named as MyTrash under /root ie: /root/MyTrash
Then open .bashrc file and write the below line at the bottom of the file.
alias rm='mv -t /root/MyTrash/'
Here -t means
-t, --target-directory=DIRECTORY
move all SOURCE arguments into DIRECTORY
update .bashrc file by running this command source .bashrc
Now if you delete any file using rm command that file will be moved to /root/MyTrash directory
I have a script run.sh located somewhere on read only directory /install/app/release_1.0.0/ and a symbolic link to that script in the fully accessed directory /packages/app/. This script operates with files using relative paths. When I'm running this script using symbolic link it's not able to locate files because it's looking in the current directory of symbolic link. How can I force it to look into the current directory of link's target? Changing the script is not prefered.
Don't use a symlink, use a wrapper instead. Remove /packages/app/run.sh and create a new file at that location, with these contents:
#!/bin/sh
cd /install/app/release_1.0.0/
./run.sh
Mark it executable (chmod +x run.sh) and that should do it.