cp: target '/path/to/directory' is not a directory - reactjs

I really confused by target /path/to/directory is not a directory when i want to copying all files in build/* to the direction in by this rule in gitlab-ci.yml file:
script:
- cp -rf build/* /path/to/directory
I've also check this command by removing/adding / at end and start of the destination but won't help.
Note: it's OK when i manually run the cp command in server terminal and have no problem with it.This command was successful when i run it manually through terminal in ubuntu server.
So what's the problem here?

it's OK when i manually run the cp command in server terminal and have no problem with it.
That is probably because the target folder exists in the server itself, while it might not exist in the context of the GitLab runner.
You should either:
create the target folder:
mkdir -p /path/to/directory
or mount the server target folder as a data volume:
volumes = ["/path/to/bind/from/host:/path/to/bind/in/container:rw"]

I experienced a similar error because one of my files had a space in its name and so the path it was looking for was only reading the string after the space.

Related

Plesk-Scheduled-Tasks reporting "No such file or directory"

I have a working Centos/Plesk (18.0.40 Update #1) environment running Plesk-Scheduled-Tasks with no problems, and I have a new machine that should be a duplicate of that machine (Plesk 18.0.42 Update #1) that is failing to run the Plesk-Scheduled-Tasks (reporting "No such file or directory" on all the tasks that I have added).
Eliminating as many permissions factors as possible, I am testing a scriptless task running "whoami" will work on the original machine but shows an "-: whoami: command not found" error message on the new.
Note, I am also declaring tasks at the domain level - if I was to add a top level task (where it prompts you for the System user) then it can use root and therefore works - but I do not want these tasks to run under root.
Clicking "Run Now" gives the following:
Hiho.
The run scheduled tasks and also the shell access if it´s enabled for your subscription is mostly chrooted. So you have only a minimum on commands which you can use here.
If you open your subscription via FTP Client you should see a bin folder in there. In the bin folder are all commands you are able to use in the chrooted shell.
Example on one of my subscriptions:
bash cat chmod cp curl du false grep groups gunzip gzip head id less ln ls
mkdir more mv pwd rm rmdir scp sh tail tar touch true unrar unzip vi wget

Accidently deleted /etc/environment file

I accidently deteleted my /etc/environment file in ubuntu using
sudo rm /etc/environment
So I just wanted to know how to recover the file. And also I haven't logged out since I deleted the file.
Please help
If you deleted by rm command you cannot restore, but if you write the command inside /etc you can create the file again.
sudo vi environment
and normally there supposed to have the following PATH. But, it depends on the server setting.
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
After that save this.

mongodb 4 Data directory C:\data\db\ not found

I download and install the last vesrion of MongoDb which is 4.0.2 and i set the correct path variable.
When i want to start the mondoDb service using mongod command i got the following error:
exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
i know that i should create the directory missing, but that directory is automatically created in the following path: C:\Program Files\MongoDB\Server\4.0
I checked the mongod.cfg file and the correct path is already set : dbPath: C:\Program Files\MongoDB\Server\4.0\data
Now how to tell the mongo to look for the folder he thinks is missing in the correct path ?
I had the same issue but after I create the directory C:\data\db\ it just worked.
I too had the same issue after an Windows update, Mongodb did not start automatically. Creating a new directory C:data/db will not be the right way as Mongodb has already configured the directory C:\Program Files\MongoDB\Server\4.0\data as datapath.
Run the following command in cmd as Administrator.
cd C:\Program Files\MongoDB\Server\4.0\bin
mongod --dbpath="C:\Program Files\MongoDB\Server\4.0\data".
This worked for me.
i tried to open CMD in admin mode and the error was gone. Hope this helps someone.
got to C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg file
update below fields with these values
dbPath: ....\data\db (directory path)
and restart server once
Create the directory/folder like below -
C:\data\db
open cmd at C:\Program Files\MongoDB\Server\6.0\bin and run 'mongod' command like below -
C:\Program Files\MongoDB\Server\6.0\bin>mongod
problem solved!
This solution may solve your problem problem
Make a directory as
sudo mkdir -p /data/db
That will make a directory named as db and than try to start with commands
sudo mongod
If you get another error or problem with starting mongod, You may find problem as
Failed to set up listener: SocketException: Address already in use
If you find that another error than you have to kill the running process of mongod by typing to terminal as
ps ax | grep mongod
Find the mongod running port and kill the process.
sudo kill ps_number
Another way is to make a specefic port when starting mongod as
sudo mongod --port 27018

how to override the already existing workspaces in rtc using command scm or lscm

I have the requirement as i need to connect to the rtc and automatically checkout the files from the stream to the repository workspace.
I am writing the following commands in the bat file.
lscm login -r https://rtc.usaa.com/ccm -u uname -P password -n nickname -c
scm create workspace (workspacename) -r nickname -s (streamname)
lscm load workspace name -r nickname -d directorypath(c:codebase/rtc)
lscm logout -r nickname
while i am executing the above batch file for the first time it is creating the workspace and loading the project into the workspace path.
while i am executing the above batch file for the second time again it is creating the duplicate workspace with the same name and getting exception while loading.
I want to override the already existing workspace every time while loading but I didn't find a command for that.
can you please provide me any other way of doing it or any command that solves my problem
It will be good to delete existing local workspace sandbox before loading the new one. In my setup, we execute the following steps:
1. Delete local sandbox (if it makes sense delete existing repository workspace too)
2. Create new repository workspace
3. Load the new repository workspace to local sandbox
Either create a uniquely named workspace (perhaps by sticking a time stamp into the name?) and then delete it when you're done, or use the workspace's UUID from the creation step.
Instead of deleting and again writing the files into workspace, you can try accept incoming changes before load and then using "--force" attribute you can overwrite only the changes made files.
Accept using - SCM accept --flow-components -r <> -u <> -p <> --target
Use force at the end of the load command which you using.
this should work fine.

fatal error when starting postgres on solaris

I'm trying to install postgres on a sun solaris sparc instance in my home directory.
Everything is fine except when I try to start postgres server, I get the following error
FATAL: "/home/reic/var/lib/pgsql/data" is not a valid data directory
DETAIL: File "/home/reic/var/lib/pgsql/data/PG_VERSION" is missing.
I used the command pg_ctl -l logfile start to start the server.
I have followed all the necessary steps for installation on sun solaris.
Any idea as to why is this happening ?
Solution:
All the necessary files are there in the PGDATA directory and I ran it as the same user which is trying to start the server. The problem is with the placement of env variables in the .bashrc instead of .bash_profile file. Apparently the customisations are not propagated to sub shells when the env variables are put in .bashrc.
My bad for not realising this! Thank you all....

Resources