Ubuntu :: Checking If File In /root Directory Exists?
Jun 6, 2010
I want to create a file in the /root directory and then make sure it exists. The following code keeps telling me that the file doesn't exist even though it does.
Code:
#!/bin/bash
echo -e "username=someusername
passwordsomepassword" | sudo tee /root/.credentials
if [ -e /root/.credentials ]; then
echo "File exists!"
[Code]...
[Edit] Added second double quotation mark at the end of "somepassword"
View 5 Replies
ADVERTISEMENT
Jan 14, 2010
I'm working on my first bash script. My script will do several things but right now I'm just trying to get the basic part of it down and working.I have a section that looks like this
Quote:
#/!bin/bash
SERVER=$1
if [ ! -d `ssh ${1} /somedir`];then
echo "Bad"
[code]...
The problem is that if you take that right now and run it, it will return back good in that it does exist. What I need it to do is pass back that it's bad because it doesn't exist (that is unless you actually do have that directory in your root).
View 1 Replies
View Related
Aug 19, 2011
I've run into a problem with my bash program.
Code:a mkdir -p /home/chris/Downloads/ARCHIVE/`date -I` find /home/chris/Downloads* -mtime +14 -exec "cp {} /home/chris/Downloads/ARCHIVE/`date -I` ;
It's meant to move old files from my Downloads folder into an archive file (later tar them). The directory exists, I've used $PWD and nautilus and ls to make sure it's there, yet for every file it gives
Code: find: `cp /home/chris/Download/foo.bar /home/chris/Downloads/ARCHIVE/2011-08-19': No such file or directory I tried to test it on a different destination, specifically my home folder. IT still gave me the error.IS it a bad syntax within find or something else? I'm running a 32-bit system with 11.04
View 4 Replies
View Related
Nov 8, 2010
I am getting the databases from mysql and my database name is username_something.
I am getting the username and then puting the respective backups in corresponding folders like
tar bala bla /backups/sql/username/username_something.tar.sql.gz
The problem is system worrks if i have the folder username already there but for new databases if get the error like unknown file path.
How can i do that if username folder is not there it should be created
View 2 Replies
View Related
May 1, 2011
I have a directory called /data In this directory I have some files like abcejb.jar,12_ab_ejb.jar, shejb.jar, test I need a shell script like... 1st I want to check if there is any ejb file exists in the directory using some condition If ejb files exists I want to redirect the ejb files list to a file called list. Now I want to copy all the files in the list file to some remote system.
View 1 Replies
View Related
Jan 17, 2009
I was transferring some files from my laptop (running FC6) to a server at my work (don't know what kind) with "scp -rpC" and it stalled, don't know why.
Now when I try to delete the files from the server so I can start again I get the following error message
Code:
rm -r Single_injections/
rm: cannot remove directory `Single_injections/195320/400mA/010': File exists
rm: cannot remove directory `Single_injections/195320/400mA': File exists
rm: cannot remove directory `Single_injections/195320': File exists
rm: cannot remove directory `Single_injections': File exists
[Code].....
View 6 Replies
View Related
Oct 19, 2010
does first line create file in tmp directory with dsuser.exists.* ?or we are assigning the path of existing file in this directory?
View 2 Replies
View Related
Jan 19, 2010
I have a Rad Hat 7.0 old Linux system that crashed due to power failure. On reboot the system goes to Checking Root File System and does 92.5% check and fails.
Here are the error messages I get.
I don't know what to do at this point so I say yes and it goes in some wierd mode.
SO I ran fsck manually but I get an error PARALLEIZING FSCK.
I can't fix the corrupted stuff for the system to reboot. THIS IS VITAL.
View 11 Replies
View Related
Apr 21, 2011
Fsck is not check any file system which are not root file system at boot time.
Normally it run: /sbin/fsck -A -R -C -a
But this command doesn't do anything.
I've tried to strace it, and looks like this:
Code:
View 2 Replies
View Related
May 21, 2011
I'm having a rather strange problem - I'm trying to run an executable which is viewable using 'ls -l', and whose assembled code can be seen in programmes such as vi, but when I run it it says "zsh: no such file or directory". Here is a transcript of the commands:
Code:
[joshua:/usr/bin]$ ls -l gst-launch
-rwxr-xr-x 1 root root 9224 2008-11-22 16:13 gst-launch
[joshua:/usr/bin]$ file gst-launch
gst-launch: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[Code]....
There's been a couple of similar questions on LQ, but only one which seemed to have a vaguely helpful answer was this one. I too am running 64-bit Slackware, so it may well be a similar problem. The poster installs "ld-linux.so.2", which I don't have on my system (I have "ld-linux-x86-64.so.2" installed, though)... However, he gets it from a package using apt, and the source package which contains ld-linux.so.2 seems to be glibc.
Is ld-linux-x86-64.so.2 in any sense equivalent to ld-linux.so.2? Have other people seen this problem, and do they believe installing ld-linux.so.2 will solve the problem? If so, is installing glibc the right way of going about it?
View 4 Replies
View Related
Jun 1, 2011
My laptop keeps shutting down out of nowhere- now more so than ever since installing Ubuntu. After starting a thread in the hardware and laptop section asking anyone if they had a solution to a well known fan problem with the Acer Aspire 5315 (my laptop), the only responses I received were rubbish in nature. Simply put, the Acer Aspire 5315 has a faulty fan which runs only when it wants to- not when the computer NEEDS it to.
I found THIS solution to my problem: [URL]. As suspected, this isn't a BIOS thing as some have told me that it was. But here's the REAL crappy part - the solution posted in this thread works up until you're about to install the fix via the terminal. The commands spit back at me that "No such file or directory exists". THUS, I'm unable to get this thing working.
I need someone to explain to me why the terminal is spitting out the garbage that it is- that no such file or directory exists when attempting to install and launch the fix for this fan issue. Please be as detailed as possible. What? Should I move the script to some sub-directory? how does this input into the terminal?
View 7 Replies
View Related
Jun 22, 2011
I have iMac 2.4GHz with rEFIT installed. I installed Unity on one of the partition. Kernel is still 2.6.38.8. I am getting error message when I run the command
sudo gedit /etc/x11/xorg.conf
The error message is
(gedit:2139): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.AC7YXV': No such file or directory
(gedit:2139): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory
View 3 Replies
View Related
Jul 22, 2011
I just logged in as root and used rm -r on a file directory, but is this the same thing as deleting it?
View 3 Replies
View Related
Apr 4, 2010
I have recently experienced a problem that occurred after an automatic update. After the update it said restart system. So I did and proceeded as normal. when after the reboot Firefox suddenly stopped working, crashed and upon clicking it again only a blank box appeared. Then my other apps followed and i soon couldn't do anything so i shut down my computer. Upon restart I got a black screen with tons of text and something around the lines of
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting / sys/ on root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or dirctory
[code]....
So I rebooted and pressed shift to open that grub thing and booted from an earlier kernel. This time it said checking HD for errors and after booted normally. Everything seemed fine but next day it did it again. Starting with Firefox crashing and then everything else. I again booted from a previous kernel and it worked but upon checking with uname -a it did not list the kernel i chose to boot from. So I decided to upgrade 10.04 to 10.10. This upgraded my kernel and deleted the old ones so i am hoping i am good now.
View 2 Replies
View Related
Aug 8, 2010
Ubuntu(10.04) was working fine, then some program crashed or something, and I just switched off (power offed) the computer. When I restarted it, this sort of stuff comes:
Code:
mount /dev on /root/dev failed : No such file or directory
and some more lines like that, and then 'Busybox' starts with [intramfs].I booted Ubuntu from a pen drive and ran fsck on the main partition. I just pressed 'y' for a long time (it asks stuff like should it continue repairing or something), and then it was done. I restarted the pc and it booted normally - it looked as if everything was fine.I started google chrome, and it said it couldn't find a personal config file .. ok. Then I tried opening a folder - nothing happens. The system monitor doesn't open, and windows that do open eventually are completely blank. I restarted the pc (this time by doing the normal restart), and it gave me the same 'Busybox' thing.I did the same procedure again, and got the same results. (ubuntu boots, programs dont work, then I restart and the Busybox thing comes again)One More Thing : The Ubuntu installed on the hard disk had all the recent updates (including the latest linux kernel) while the pen drive thing was around 2 months old I think. So maybe that's the cause?
View 1 Replies
View Related
Jan 21, 2010
How to check if a directory exists in Linux command line?
[Code]....
View 5 Replies
View Related
Apr 9, 2010
Im trying to add users to my nfs server with a specific home directory that already exists. Can this be done? I've done some research on google and other forums but cant seem to find the answer.
View 7 Replies
View Related
Apr 20, 2009
I am trying to write some small script file that will check if a USB stick is connected to my pc or not. I can't seem to get it to work, but I am sure it is a very simple fix.
I am running on Fedora core 10.Can anyone help me figure out what the problem is?If I run these lines through console it works fine (meaning, I type the commands in this file straight in the command line/console).
View 9 Replies
View Related
Jun 1, 2011
In a fresh install of 11.4 I see a file named "1" (the number "One") in the / (root) directory.
Code:
vodoo@host:/> ls -l 1
-rw-r--r-- 1 root root 0 May 31 11:29 1
Who creates this file and what is it good for?
View 9 Replies
View Related
Nov 2, 2010
I am running WHM and CPANEL on centos.I would like to upload a file to the root user directory. To be honest, my only experience uploading and downloading files with FTP has been with domain related accounts that were set up under WHM to be managed under CPANEL. This is quite simple, because all you do is set FileZilla or Dreamweaver up with the FTP address of the domain account and the username and password.How can I do something similar to FTP a file into the root or home directory?
View 1 Replies
View Related
May 12, 2010
I want to copy file from the Server cd drive and USB drive to the server root directory, but I haven't find any command of listing the cd drive or usb drive.
View 4 Replies
View Related
Feb 9, 2011
After upgrading from 10.04 to 10.10 I have had some problems booting my Ubuntu. It all started when restarting after the upgrade, and I got the error;
Code:
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting / sys/ on root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or dirctory
Target filesystem doesn't have /sbin/init.
No init found. Try passing init= boot arg
BusyBox v1.13.3 (Ubuntu 1:1.13.3.1ubuntu11) built-in shell (ash)(initramfs) After searching the Internet, I found a "solution". I just had to boot with a USB stick with the Ubuntu Rescue Remix (the normal Ubuntu USB won't boot either), and i wrote;
Code:
sudo fsck /dev/sdb5
Now I could start my Ubuntu again. So whats the problem? If I turn off my computer the normal way, there is no problem, but if I log off, put it into sleep mode, if something happens and I have to turn it off with the button it goes back to the first problem, and I have to reboot it with the USB stick and fix it all over again! If I don't have the USB stick with me, I probably wont be able to use my laptop!
View 9 Replies
View Related
Feb 21, 2011
since running update manager on my daughters net running 10.04 netbook on boot up I get the following on the screen
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
Target filesystem doesn�t have /sbin/init.
[code]....
View 2 Replies
View Related
May 14, 2011
Doesn't seem to matter which version, every time I try to install Software raid on an Ubuntu server system, it blows up with this error. Seems I've had trouble for several versions.
Code:
mount: mounting /dev/disk/by-uuid/f35415ee-4c14-4eb1-995f-f19fbcd760c7 on /root
failed: Invalid argument
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
[code]...
I've done it on Centos Fine, and followed the many different instructions I've seen for Ubuntu. The only luck I've had was with bios raid, but I would much rather let Mdadm handle things.
My build:
ubuntu-10.04.2-server-amd64 CD install
AMD 1055T 6Core
4GB ram
Asus M4A88TD-MUSB3
[code]...
I install both as letting Ubuntu decide partitions for one drive, do the same for the other, and create a raid, and do them from scratch. No dice, same problem. I've tried that one as logical and as primary too. No difference. Something just doesn't like booting from a raid 1 Mirror. I've tried installing grub on both HDDs (sda1 + sdb1)I've tried several CDs, burned from several machines. Re-downloaded from Torrent and from the website. The DVD drives work since I purchased new DVD drives for both one workstation and the server. Things install fine under CentOS, software raid comes up.
View 1 Replies
View Related
Jul 20, 2010
Why do I always need to write "su" then my password to extract or copy any file in fedora 11. How to configure so that I always be in my root directory.
View 3 Replies
View Related
May 23, 2011
Not sure but has support and updates for 11.2 come to an end? Every monday morning i make sure i'm upto date with updates etc. This am i get a message saying "repo not available" and having looked online to see if the directory openSUSE_11.2 exists, it doesn't.
At the same time loged in as a std user i regularily offer the command kdesu kwite. the command is accepted without error and the cursur returns on a new line as expected but kwrite doesn't start. I'm guessing that my last update has left me with a broken OS. It doesn't seem very long at all since i installed 11.2!
View 9 Replies
View Related
Jan 17, 2011
I am new to scripting, would like to have a script that tests whether a directory exists on remote host & display the message accordingly. The remote hostname can be provided by means of file containing list of hostnames. Can use rsh for connecting to remote host.I tried with couple of scripts by searching google but didn't get desired result. Please help me, below is my efforts, $file contains list of hostnames.
View 10 Replies
View Related
Feb 19, 2011
Okay, so on occasion when I boot into ubuntu I get this error
[mount: mounting /dev /root/dev failed: no such file or directory]
[mount: mounting /dev /root/sys failed: no such file or directory]
[mount: mounting /dev /root/proc failed: no such file or directory]
[code]...
I get the error when I open any of the kernel versions or any recovery mode. Ubuntu 10.10 Desktop is the only OS installed on the computer, which is a Lenovo S10-3. I can eventually get it to go away, sometimes by repeatedly unplugging it and plugging it back in, and sometimes I will boot into GParted, do nothing, then restart and it will work.I have found some solutions online, but all of them involve the error happening as a result of dual booting with Windows.I have made no major system changes recently, so I can't see anything like that being the problem.
View 3 Replies
View Related
Sep 15, 2010
I have switched recently from Ubuntu to Debian and overall I am enjoying it. However I was just wondering, does Debian, like Ubuntu check the filesystem at boot periodically or if damaged, because it is doing neither in my case? How do I get it to do this
View 6 Replies
View Related
Jan 11, 2010
I have seen this message more then once and I cannot find information that is understandable to me and which is recent, so maybe the situation has changed with newer kernels/file systems. My question: is this normal behavior with linux and beside from increasing the number of start-ups after which this check runs, is there another way to avoid this? Isn't there a way to do a check after the os has been loaded?
View 14 Replies
View Related