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.
Related
So I've got the following project OpenFHE-development and when I run the build process, there are lots of warnings. However, most of these warnings are fine to ignore (we vet them before pushing to the main branch)
Specifically, is there a way to take
pth/python -m sphinx -T -E -b readthedocssinglehtmllocalmedia -d _build/doctrees -D language=en . _build/localmedia
and convert it to
pth/python -m sphinx -T -E -b readthedocssinglehtmllocalmedia -d _build/doctrees -D language=en . _build/localmedia 2> errors.txt
(pipe the stderr to a file instead of having it display on stdout)?
Does not seem to be possible at the moment. See git discussion
I pass the following as my GCE startup script but it always logs in as the root user and never as the demo-user. How do I fix it?
let startupScript = `#!/bin/bash
su demo-user
WHO_AM_I=$(whoami)
echo WHO_AM_I: $WHO_AM_I &>> debug.txt
cd..`
I think it should work like that:
#! /bin/bash
sudo -u demo-user bash -c 'WHO_AM_I=$(whoami);
echo WHO_AM_I; $WHO_AM_I &>> debug.txt;'
use "sudo-u" to specify the user, then bash -c 'with all the commands between these particular quotes '' and separated by ;
For example: bash -c 'command1; command2;'
You can try an easier test (it worked for me), for example:
#! /bin/bash
sudo -u demo-user bash -c 'touch test.txt'
And then check with ls -l /home/demo-test/text.txt that demo-test is the owner of the new 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.
I have noticed that when gsutil rsync is working, it will return a non-zero error code out if it encounters a symlink which it can not resolve:
$ gsutil -m rsync -r -C /my_folder/ gs://my_bucket/
CommandException: Error opening file "file:////my_folder/my_symlink": .
CommandException: 1 files/objects could not be copied/removed.
Is there any way I can exclude such symlinks during the sync and make gsutil return error code 0?
I do not know the names of the symlinks.
As stated in the gsutil rsync documentation the -e parameter is used to ignore symbolic links.
Your command would look like:
gsutil -m rsync -r -C -e /my_folder/ gs://my_bucket/
I hope this is what you are looking for.
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