Is it possible?
I have a network disk mounted. How do I save the files (folders and files recursively) to my local disk preserving permissions?
Thank you...
I am reading some source code and I found at the very begin of the main routine
this statement:
umask(077);
What could be the reason for that?
The man page (man 2 umask) states:
umask -- set file creation mode mask
This clearing allows each user to
restrict the default access to his
files
But is not clear to me why would do that? as a shortcut ?
I need to build a function which parses the domain from a url.
So:
http://google.com/dhasjkdas/sadsdds/sdda/sdads.html
or
http://www.google.com/dhasjkdas/sadsdds/sdda/sdads.html
Would become "google.com" and
http://google.co.uk/dhasjkdas/sadsdds/sdda/sdads.html
would become "google.co.uk"
fileexist=0
for i in $( ls /data/read-only/clv/daily/Finished-HADOOP_EXPORT_&processDate#.done); do
mv /data/read-only/clv/daily/Finished-HADOOP_EXPORT_&processDate#.done /data/read-only/clv/daily/archieve-wip/
fileexist=1
done
--some other script below
Above is the shell script I have in which in the for loop, I am moving some files. I want to notify myself via email if something wrong got happened in the moving process, as I am running this script on the Hadoop Cluster, so it might be possible that cluster went down while this was running etc etc. So how can I have better error handling mechanism in this shell script? Any thoughts?
So i have a 1 long line with characters, for example numbers[1-1024] in one line(no "\n", "\t" and "\b"):
1 2 3 4 5 6 7 8 9 10 11 ... 1024
How do i extract and print characters for example exactly 55 characters after 46? So output would be:
47 48 49 ... 101
Thanks.
I'm looking for a way of mapping a uid (unique number representing a system user) to a user name using Perl.
Please don't suggest greping /etc/passwd :)
I constantly hear from other people about how much of the stuff they've used to customize their *nix setup they've shamelessly stolen from other people. So in that spirit, I'd like to start a place to share that stuff here on SO.
Here are the rules:
DON'T POST YOUR ENTIRE DOTFILE. Instead, just show us the cool stuff.
One recipe per answer
You may, however, post multiple versions of your recipe in the same answer. For example, you may post a version that works for bash, a version that works for zsh, and a version that works for csh in the same answer.
State what shells you know your recipe will work with in the answer.
Let's build this cookbook as a team. If you find out that an answer works with other shells other than the one the author posted, edit it in. If you like an idea and rewrite it to work with another shell, edit the modified version in to the original post.
Give credit where credit is due. If you got your idea from someone else, give them credit if possible.
And for those of you (justifiably) asking "Why do we need another one of these threads?":
Most of what I've seen is along the lines of "post your entire dotfile." Personally, I don't want to try to parse through a person's entire dotfile to figure out what I want. I just want to know about all the cool parts of it.
It's helpful to have a single dotfile thread. I think most of the stuff that works in bash will work in zsh and it may be adapted to work with csh fairly easily.
This is RHEL 5.6 and GNU find 4.2.27.
I am trying to exclude a directory from find, and want to make sure that directory isn't descended into. I've seen plenty of posts saying -prune will do this - and it does. I can run this command:
find . -type d -name "./.snapshot*" -prune -o -print
and it works. I run it through strace and verify it is NOT descending into .snapshot.
I also want to find directories ONLY at a certain level. I can use mindepth and maxdepth to do this:
find . -maxdepth 8 -mindepth 8 -type d
and it gives me all the dirs 8 levels down, including what's in .snapshot.
If I combine the prune and mindepth and maxdepth options:
find . -maxdepth 8 -mindepth 8 -type d \( -path "./.snapshot/*" -prune -o -print \)
the output is right - I see all the dirs 8 levels down except for what's in .snapshot, but if I run that find through strace, I see that .snapshot is still being descended into - to levels 1 through 8.
I've tried a variety of different combinations, moving the precedence parens around, reording expression components - everything that yields the right output still descends into .snapshot.
I see in the man page that -prune doesn't work with -depth, but doesn't say anything about mindepth and maxdepth.
Can anyone offer any advice?
Thanks...
Bill
Hi, there.
The question is how to make the similar thing like symlink in windows like in *nix. It's really hard to write whole path to the file in console (even using [tab], it's not the way if you need to change language). Adding everything in PATH is tiring too. It'll be great to make a symlink running one command.
Actually I'm looking for console app.
I have following problem.
I register a cookie
Set-Cookie EhdSite_SessionId=b0ptrr45xgclea55kjqp2o45; path=/; HttpOnly
Do something on the same host (user always sends cookie header)
Cookie EhdSite_SessionId=b0ptrr45xgclea55kjqp2o45
then I redirect user to other host
After filling all the required data user went back to first host
Here user doesn't send the cookie
Does that mean that without expiration date cookie is destroyed by browser not when closing browser but when leaving the domain
I'm using find for a task and I noticed that when I do something like this:
find `pwd` -name "file.ext" -exec echo $(dirname {}) \;
it will give you dots only for each match. When you s/dirname/basename in that command you get the full pathnames. Am I screwing something up here or is this expected behavior? I'm used to basename giving you the name of the file (in this case "file.ext") and dirname giving you the rest of the path.
I have an application with fairly high traffic (20K req/min) running on the JVM with a Jetty servlet container on Ubuntu. Below is my Jetty configuration:
10
20
2000
2
When I analyze the network traffic, I realize that sometimes it is taking long to establish TCP connections on the port that Jetty is running. The long connections are varying between 3.0s and 9.0s. The port is configured to accept MAX number of TCP connections. Do you know what might be causing the delay in accepting connections?
Thanks
Here is the header from firebug that shows the scope of the PHP Session cookie:
Set-Cookie PHPSESSID=f0e2dfe56cc78be718c8154ac80d1ae2; path=/; domain=pix-all.com
But still the PHP Session cookie is been sent for any requests to static.pix-all.com
Cookie PHPSESSID=f0e2dfe56cc78be718c8154ac80d1ae2;
What could be the problem?
Scenario:
We provide a hosted site that clients pay to use internally (a tool to support their business workflow). We have a requirement to provide a form that the clients can 'embed' in their outward facing site. This form will permit a member of the public to enter some details to register an interest - this data will be pushed to our remote system.
Question:
I'm currently planning on creating a simple HTML page that the client's web guys can include in a simple fashion on their site (either using an iframe or an object tag). If I do this, am I going to run into difficulties when the user tries to submit the embedded form (as it will be going to different domain to the one they are currently browsing)?
I had a look at google adsense and I see that they just provide a link to a JS file that renders their ads - I'm not sure I see the advantage in this, but if anybody has any bright ideas...
Whatever technique that gets used, I'll have to authenticate the request as coming from my client's site(s).
Does anyone check the domain of an email address as part of their verification steps? eg. Confirm that gmail.com exists if the user specified [email protected] as their address.
Hi,
Does the following cron expression mean "execute every other Sunday?" (I'm trying to use it with the Spring Quartz scheduler)
0 0 3 ? * 2/1 *"
Thanks
Nick
i am developing web based HRIs application which is to be deployed on intranet and for dat m using
Frontend : jsp/servlets
Backend : Oracle
Application Server : Tomcat
in my web application i want domain login which means by tracing currently logged in user he should automatically logged in my web application
pl give me the possible solution
Thanks in Advance
I'm looking for a good multi-thread-aware debugger, capable of showing performance charts of application threads on Linux, don't know if such a thing exists, perhaps as a Eclipse plugin.
The idea would be to track per thread memory allocation a CPU usage as well as being able to interrupt a thread and examine its stack trace, local vars, etc.
It does not have to be an eclipse plugin or a free tool, do any of you have heard of something similar?
Hei everyone!
I have this variable in shell containing paths separated by
a space:
LINE="/path/to/manipulate1 /path/to/manipulate2"
I want to add additional path string in the beginning of the string and as well right after the space so that the variable will have the result something like this:
LINE="/additional/path1/to/path/to/manipulate1 additional/path2/to/path/to/manipulate2"
Any help appreciated
Thanks in advance
I have a number of .css files spread across some directories. I need to find those .css files, read them and if they contain a particular class definition, print it to the screen.
For example, im looking for ".ExampleClass" and it exists in /includes/css/MyStyle.css, i would want the shell command to print
.ExampleClass {
color: #ff0000;
}
HOSTNAME=$1
#missing files will be created by chk_dir
for i in `cat filesordirectorieslist_of_remoteserver`
do
isdir=remsh $HOSTNAME "if [ -d $i ]; then echo dir; else echo file; fi"
if [ $isdir -eq "dir" ]
then
remsh $HOSTNAME "ls -d $i | cpio -o" | cpio -id
else
remsh $HOSTNAME "ls | cpio -o" | cpio -id
fi
done
i need simple solution for checking remote file is directory or file ?
thanks
I have always done this:
mysqldump -hlocalhost -uuser -ppass MYDATABASE > /home/f/db_backup/MYDATABASE.sql
mysql -uuser -ppass MYDATABASE < MYDATABASE.sql
But, if I do this instead...is this safe? Is this identical to the above???
mysqldump -hlocalhost -uuser -ppass MYDATABASE | gzip > /home/f/db_backup/MYDATABASE.sql.gz
zcat MYDATABASE.sql.gz | mysql -uuser -ppass MYDATABASE