I'd like to open a pipe using popen() and have non-blocking 'read' access to it.
How can I achieve this?
(The examples I found were all blocking/synchronous)
I want to compare two files and see if they are the same or not in my shell script, my way is:
diff_output=`diff ${dest_file} ${source_file}`
if [ some_other_condition -o ${diff_output} -o some_other_condition2 ]
then
....
fi
Basically, if they are the same ${diff_output} should contain nothing and the above test would evaluate to true.
But when I run my script, it says
[: too many arguments
On the if [....] line.
Any ideas?
I have a daemon writing to a log file that, eventually, fills up the disk. Is there a way for me to periodically limit the size of the log file without stopping the daemon without changing the code in it? SIGHUP kills the daemon.
I have a command line program written in Python, and when I pipe it through another program on the command line, sys.stdout.encoding is None. This makes sense, I suppose -- the output could be another program, or a file you're redirecting it into, or whatever, and it doesn't know what encoding is desired. But neither do I! This program will be used by many different people (humor me) in different ways. Should I play it safe and output only ascii (replacing non-ascii chars with question marks)? Or should I output UTF-8, since it's so widespread these days?
Is it possible to use ffmpeg create a video from a set of sequences, where the number does not start from zero?
For example, I have some images [test_100.jpg, test_101.jpg, test_102.jpg, ..., test_200.jpg], and I want to convert them to a video. I tried the following command, but it didn't work (it seems the number should start from zero):
ffmpeg -i test_%d.jpg -vcodec mpeg4 test.avi
Any advise?
I've searched for an exhaustive explanation of the meaning of each event monitored by the perf stat command;
I've found a tutorial which explains quite well how to use different the features of the perf tool. However, it doesn't explain the meaning of several events that can be observed (and there are a lot!!).
Someone know where is a quite simple and complete documentation about the events listed by the perf list command?
In particular, I'm interested in finding out the percentage of cpu used by some application I wrote.
Can i measure it directly through cpu-clock or task-clock?
What's the meaning of these two events?
Thanks in advance
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
I have a classifieds website, and users may post classifieds, add images, remove classifieds etc etc...
I have no idea what to set the permissions to on folders.
For instance, a php script which I have uploads a file to a directory.
What would you have set the directory permissions to?
Nobody need access to the directory, only the php script...
Just wonder if anybody has a good (brief) article about setting the "right" permissions?
Thanks
I'm using grep to generate a list of files I need to move:
grep -L -r 'Subject: \[SPAM\]' .
How can I pass this list to the mv command and move the files somewhere else?
You usually invoke the following commands to build a ./configured product:
make
make install
Okay, the product is in the system now. Then you change some source code files and invoke only make install. The question is, does the conventional implementation of install target requires the executables to be recompiled, or just the old ones should be copied to the appropriate system path?
I have found the code which links against of 'g2c' library. Why do I need it? Just would like to understand why it might be important and what it does in general.
Thanks!
I am working with a file upload script. I am currently uploading a file and then trying to echo out an anchor linking to that file, but since I used mkdir() with 0700 permissions to upload the file, it won't allow me access to view the file.
I am pretty sure the problem I am experiencing is because of the file permission code I used. The problem is I just don't know what all the different file permission codes are and what they mean.
Can somebody please list out all the different file permissions and what they each do?
My .deb package, built on 32-bit Ubuntu and containing executables compiled with gcc, won't install on the 64-bit version of the OS (the error message says 'Wrong architecture i386'). This is confusing to me because I thought that in general 32-bit software worked on 64-bit hardware, but not vice-versa.
Will it be possible for me to produce a .deb file that I can install on a 64-bit OS, using my 32-bit machine? Is it just a matter of using the appropriate compiler flags to produce the executables (and if so what are they), or is the .deb file itself somehow specific to one processor architecture?
Is there any protection provided by kernel? Because when we tried to allocate memory using an
kmalloc() from user space, the kernel allowed to allocated around 124
MB of memory, and when we try to write into it, the kernel crashed. If there
was protection of kernel memory area, this wouldn't have happened, i guess
Is there a command to tell compiz that we want to bring in front and set focus to a specific window?
How should we identify the window in that command?
The reason behind this question is the following use-case:
Suppose we have a wiki to keep notes of anything interesting we find out. It would be very convenient to have a keyboard shortcut to bring the browser window with our Wiki page in front and start typing immediately then with another key combination switch to the application we were working before
I know that "ALT+TAB" switches between the last two used windows but cannot support more complex combinations of applications. E.g Browser+Eclipse+ Wiki
If there is a command like the one described, it is easy to add a shortcut to it from KDE or GNOME interface
Thanx ...
When consulting bash's man page, it read this sentence about bash history:
The second and subsequent lines of a multi-line compound command are
not tested, and are added to the history regardless of the value of
HISTCONTROL.
But I have tried this:
$ HISTCONTROL=ignorespace
$ if [ -f /var/log/messages ]
> then
> echo "/var/log/message exists."
> fi
$ history | tail -2
18 HISTCONTROL=ignorespace
19 history | tail -2
Note that the if is leaded by a space. Why the second line of this if compound command still not appear in the history?
i would like to automate the rsync task as a cron job.. since it needs the passphrase i am not able to do the cronjob. i need to specify the passphrase along with the rsync command or i will store the passphrase in a file and i will read from it. my command will look like this..
rsync -aPe "ssh -i ' . $server-{'ssh_key'} . '" ' . $server_lock_dir;
so where do i put the password .. pls help
My Windows application runs under Wine, but the installation is a bit of a headache for laymen, and the wrappers I've seen online (PlayOnLinux, Wine Doors) require even more packages to be installed. Is there a way to make a package that will install Wine if the user needs it to be installed, install the application and shortcuts, all with minimal user hassle?
hi,
consider a kernel tasklet scheduled and executing the tasklet function.
Is there a way to know which core the tasklet is running ?
I mean is there a function / variable to know at which core the tasklet is running at.
Architecture is arm.
Thanks!
Every x minutes I grab an image from a network-cam. Now i want to add this picture to an existing video file - on the fly.
I don't want to keep numerous image files and then encode them once in a while with e.g.
mencoder mf://@${LIST} -mf type=jpg:fps=${FPS} ...
The video format/codec doesn't really matter, as long as standard tools (mplayer, ffmpeg, vlc, ...) can handle it.
Any ides or suggestions?
Thanks in advance!
Application scenario:
I have the (normal/permanent) /var/log mounted on an encrypted partition (/dev/LVG/log). /dev/LVG/log is not accessible at boot time, it needs to be manually activated later by su from ssh.
A RAM drive (using tmpfs) is mounted to /var/log at init time (in rc.local).
Once /dev/LVG/log is activated, I need a good way of appending everything in the tmpfs to /dev/LVG/log, before mounting it as /var/log.
Any recommendations on what would be a good way of doing so? Thanks in advance!