Argument list too long - Apache - mysql

I'm following this tutorial on deploying an wordpress application inside an AWS instance http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html and I get an error when I do
[ec2-user#ip-10-10-1-73 ]$ find /var/www -type f -exec sudo chmod 0664 {} +
sudo: unable to execute /bin/chmod: Argument list too long
sudo: unable to execute /bin/chmod: Argument list too long
What is the root problem of this error?

So you are trying to pass to many arguments to chmod, you could be running out of stack space. This is a limit you can set on linux using ulimit, but personally I would just modify the command
find /var/www -type f -exec sudo chmod 0664 {} \;
The difference is that with the + you are trying change the permissions of all the files at once, with \; you are setting the permissions one file at a time

Related

Can I use wildcards in oc exec commands?

I am trying to run remote commands on the openshift pods to delete some files in certain directory and the below command works:
oc exec mypod -i -t -- rm -f /tmp/mydir/1.txt
However, i am unable to use wildcards e.g *.txt to remove all .txt files. The command with wildcards does not give any errors but doesn't delete any files.
Any suggestions will be appreciated.
The following command worked:
oc exec mypod -i -t -- find /tmp/mydir -type f -name '*.txt' -delete
Hopefully it will be useful to someone else.

How to set file write permission

I want to install Magento 2 on Centos 7, during installtion, file write permission error display as following:
File Permission Check
4 file permission not met. Hide detail
The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables.
For help, see our File Permission Help or call your hosting provider.
 "/var/www/html/app/etc" - Not writable, change the permissions.
 "/var/www/html/var" - Not writable, change the permissions.
 "/var/www/html/pub/media" - Not writable, change the permissions.
 "/var/www/html/pub/static" - Not writable, change the permissions.
Then I gave command via ssh:
1. sudo chown -R apache:apache /var/www/html
2. sudo find var vendor pub/static pub/media app/etc -type f -exec chmod u+w {} \;
3. sudo find var vendor pub/static pub/media app/etc -type d -exec chmod u+w {} \;
But the error is still in there, so how to give this file write permission.
Try chmod -R a+w /path/to/folder/
chcon -R -t httpd_sys_rw_content_t /path/to/folder/
if selinux is enable

Find stops after the first file

Please help me understand why ncu is causing a find operation to stop after the first file? I have 25 project folders, all with their own package.json and bower.json file (not all have bower.json).
Issuing this command with an echo works perfectly:
find ../ -name "package.json" -type f -exec echo '{}' +
... all files are printed to the screen.
However, this syntax stops after the first file when I use ncu:
find ../ -name "package.json" -type f -exec ncu -u -a --packageFile '{}' +
Here's the only output of the command:
$ find ../ -name "package.json" -type f -exec ncu -u -a --silent --packageFile '{}' +
Using /home/joeblow/projects/app01/package.json
[..................] - :
All dependencies match the latest package versions :)
The versions I'm using is:
bash version: 4.3.42(1)-release
find version: 4.7.0-git
node version: 6.9.4
npm version: 4.1.2
npm-check-updates version: 2.8.9
ncu (aka npm-check-updates) silently ignores all but the first file.
Use -exec ncu -u -a --packageFile '{}' \; instead to only run it with a single file at a time.

How to find last mysql dump file in directory and inport it

I just found Vigrant, and I am trying to make a script that set up fully my development environment. I am using Ubuntu 14.04.01 like a server. With scrip now I install LAMP, set up a password for MySQL, and change the LAMP server public directory. Now I have a directory with many .sql dump file. I want to find the newest one and import it to my database. I have a problem with importing my last created .sql dump of database. I found a command that find last created file in directory.
find /vagrant/VagrantFiles/DB/ -type f -exec stat -c "%n" {} + | sort -r | head -n1
But when add mysql command to import it mysql --user=root --password=pass < {} and execute line like this:
find /vagrant/VagrantFiles/DB/ -type f -exec stat -c "%n" {} + | sort -r | head -n1 | mysql --user=root --password=pass < {}
I get the error in terminal -bash: {}: No such file or directory
How I can make this work?
Hi after two days of searching the solution I found it.
I just separate this command in two part. Firs find newest file and remember it to variable, then execute mysql command with this variable. My inspiration for this solution is this post. And here it is the solution:
last_dump=$(find /vagrant/VagrantFiles/DB/ -type f -exec stat -c "%n" {} + | sort -r | head -n1)
mysql --user=root --password=pass < $last_dump

Compile mysql client under cygwin with cmake

I need a mysql-client for Eclipse Helios/Perl EPIC, running under windows7. Perl5.10 is running under cygwin on the same machine. I'm really strugglying to compile mysql sources with cmake under cygwin. I have also read the transition guide from "configure" to "cmake".
Here is the last test I tried among dozen of previous variants :
Libraries and source Preparation :
apt-cyg install make cmake gcc4-core gcc4-g++ libncurses-devel libncursesw-devel readline libstdc++6 libstdc++6-devel
mkdir -p /usr/local/src
mkdir -p /usr/local/mysql
cd /usr/local/src
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.9.tar.gz/from/http://mirrors.ircam.fr/pub/mysql/
find . -type f -name "*.tar.gz" -exec tar -zxvf {} \;
find . -type d -name "mysql-*" -exec cd {} \;
Build/Install
CC=gcc; CFLAGS=-O3 ; CXX=gcc ; CXXFLAGS=-O3; export CC CFLAGS CXX CXXFLAGS
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_EMBEDDED_SERVER=0 -DWITH_LIBEDIT=0 -DISABLE_SHARED=1
Build is stopped at 86% with
[ 86%] Building CXX object sql/CMakeFiles/mysqld.dir/main.cc.o
Linking CXX executable mysqld.exe
Creating library file: libmysqld.dll.a
libsql.a(mysqld.cc.o):mysqld.cc:(.rdata$_ZTV12Comp_creator[vtable for Comp_creator]+0x10): undefined reference to `___cxa_pure_virtual'
collect2: ld returned 1 exit status
make[2]: *** [sql/mysqld.exe] Error 1
make[1]: *** [sql/CMakeFiles/mysqld.dir/all] Error 2
I read 100's of threads but blindly as lacking compilation skills.
Maybe is there also an alternative or better solution to run my existing mysql debugging server hosted in a Debian's VM (as guest on my windows machine) from Eclipse.. ?
Suggestions are more than welcome.
Thx in advance
hum, looks like that there is no absolute need to do that to use perl epic with Eclipse, as cygwin perl embeds already the DBI modules (to be loaded with CPAN). So it's a way to get around this problem.