Ubuntu :: Checking To See If A Directory Exists Remotely?
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
ADVERTISEMENT
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
View Related
Aug 19, 2010
I'm trying to set up an SSH connection from my school to my home, but not on port 22. I originally tried port 2222, but it didn't work. I called my school IT people and they said they block that port. I asked if they care if I set up an SSH and they said no, but that they wouldn't tell me which ports are blocked and which are open for "security" reasons (which I guess I can actually understand). They suggested just using port 22 or 222, but said if a ports open I can use it.
My question is, can I check ports without setting up SSH? It seems like a hassle to try a different port every day on my home SSHD file, come to school, see if it works and repeat. Is there a way I can check my computer home for connections that could connect, even if there isn't a service listening? I don't know how to do that, or even if its possible. If not, I suspect I'll just try a few until I find something that works, or just go ahead and use 22.
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
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
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
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
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
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
Jul 15, 2010
I have a computer (C1) to which I can connect through the Internet (ssh, for instance) (it has a static ip and though it is sitting behind a router, the appropriate ports are all forwarded). I have another computer (C2) that doesn't have a fixed ip address and sits behind a router that I cannot fiddle with (so no port forwarding here). I would like to know if there is any way to connect from C2 to C1 such that a directory on C2 would be mounted on C1.
View 5 Replies
View Related
Apr 23, 2010
I have a bash script that uses sshfs to remotely mount an SSH directory.
Where should i place this script so it mounts with route privileges?
One consideration is i use VPN so the directory needs to be mounted after openvpn is started.
View 3 Replies
View Related
Oct 14, 2009
I am writing a script that is checking the ownership and permissions of a directory. If the directory in question does not have the correct ownership and permissions, the script will run the appropriate commands to give it the correct settings. The if...then...else syntax. The idea here is the following:
Code:
If <directory> no eq = <ownership root:root> && <permissions 755>
then chown root:root <directory> && chmod 755 <directory>
else exit
fi
What would the correct syntax be for the If line of the loop in question?
View 8 Replies
View Related
Jan 22, 2011
I followed this doc for the "debian method" for building the kernel: [URL]. I installed the source in /var/tmp/src/linux-2.6-2.6.32 , configured it, and tried make-kpkg modules-image. The error I get is:
checking for current directory... /usr/src/modules/alsa-driver
checking cross compile...
checking for directory with ALSA kernel sources... ../alsa-kmirror
checking for directory with kernel top-level makefile... /var/tmp/src/linux-2.6-2.6.32
checking for directory with kernel headers... failed
make[2]: *** [configure-stamp] Error 1
make[2]: Leaving directory `/usr/src/modules/alsa-driver'
make[1]: *** [kdist_image] Error 2
make[1]: Leaving directory `/usr/src/modules/alsa-driver'
Module /usr/src/modules/alsa-driver failed.
I tried some hacks such as setting KBUILD_SRC or ln -s linux-headers-2.6.32-5-amd64/ /usr/src/linux - but these fail too.
View 2 Replies
View Related
Nov 19, 2010
i was not able to install alsa...showing the error checking for directory with kernel source... Please install the package with full kernel sources for your distribution or use --with-kernel=dir option to specify another directory with kernel sources (default is /lib/modules/2.6.18-194.el5xen/source). my friends installed the alsa for cent os 5.4...how to rectify this...
View 3 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
Jan 4, 2011
Does anyone know or recommend some software or a script to remotely power on a PC from standby to on, or even better from completely off?
I guess the completely OFF to ON is much more complicated - would probably require an extra piece of hardware(?)
View 2 Replies
View Related
May 10, 2010
Sometimes at startup I get this message "Checking disk 1 of 1". Does that mean it's checking all partitions on the hd? After a bad shutdown there is no prompt for fsck to run and the system just boots up. In fstab I have both options set to "1" for the partition Ubuntu is on, all others set to "0". Any ideas on both?
View 3 Replies
View Related
Jun 29, 2011
I'm not terribly new to Linux, but I am new to the forums, so hear me out! I am in the process of creating an electronic mapwall for our meteorology program, and have designed the computing system from scratch. I have two Linux Boxes, each with capabilities for 6 attached monitors...a total of 12 displays driven from two machines. My intention is to have one machine be the master...it has a touchpanel control. The inputs to the touchpanel will then trigger events for the both the master and the slave machine to display. Each of them has a specific IP address (DNS entry), and are not on a subnet.
Now...is there a way to remotely login to the slave machine and have it display on it's OWN monitors? The code is Java and which works on the master machine to animate directories of .gifs for each of the master's attached monitors. I will most likely have Java execute shell commands for the remote login (ssh), but I believe the answer lies somewhere in the X-configuration. Do I have the machines in an adverse configuration (creation of a subnet would be better)? Lots of questions...lots of desire...few answers!
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
Aug 19, 2010
I downloaded the latest version Ubuntu from ubuntu.com and I am trying to install Oracle XE from the below link but for the first step couldn't find "deb" command, is the command replaced[URL]
View 3 Replies
View Related
Jan 26, 2010
i think a bug exists in the default cd dvd writer for ubuntu. where would i report that?it asked whether id like to use the third iso standard because the file was larger than 2 gigs, and i did, and the checksum failed at the end, reporting an error and confusing me for a few minutes.
View 3 Replies
View Related
Jul 14, 2010
i have network ( 5 windows and one ubuntu )simply i changed the hostname of my ubuntu pc and changed the workgroup name put the old pc name ( old hostname ) still on the network also the old workgroup name
View 2 Replies
View Related
Jan 15, 2010
I have an external css filewith...
Code:
#bg {
margin:0 auto;
[code]....
View 2 Replies
View Related
Jan 24, 2010
I have a very strange problem.Few days ago everything was working fine.Now every site I'm developing under /var/www doesn't open at all.If i have a file /var/www/siteone/index.php, when i try to open http://localhost/siteone/index.php it's not opening. And IT USED TO OPEN few days ago.It seems that php is working: http://localhost/index.php is working.I'm using .htaccess in subfolders. I remove it for tests - nothing changed.What new i did to my Ubuntu:Installing of VMware Server 2.0.2 + Windows XP as a guest. Works fine.Strange error/warning from error.log in apache2 folder:PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/apc.so' - /usr/lib/php5/20060613+lfs/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0[Sun Jan 24 18:34:02 2010] [error] [client 127.0.0.1] File does not exist: /var/www/siteone/localhostWhy this localhost appears at the end of line?I'm using linux/ubuntu for about 3 months already - i'm not confident with it.
View 2 Replies
View Related
Mar 11, 2010
doesn't the chkconfig command exists for ubuntu? or is it only for red hat systems?
View 9 Replies
View Related
Oct 8, 2010
I'm setup on a virtual dedicated server with a host running ubuntu, but I'm trying to setup subversions.Now I can set it up in say /svn/myrepository But I want to set it up on one of my websites e.g.
/var/www/vhosts/example.com/httpdocs
but when i run svnadmin create on httpdocs i get the following error.
svnadmin: Repository creation failed
svnadmin: Could not create top-level directory
svnadmin: 'httpdocs' exists and is non-empty
View 1 Replies
View Related