Jenkinsfile ,by using sh, says No such file or directory, but it exists - linux

I'm studying jenkins, trying to package a maven project to a war, then move it to a previously started tomcat webapps directory(/opt/tomcat/latest/webpass), but it reports 'No such file or directory'.
Already find out what causes this, but don't know why. Jenkins don't use the same filesystem as original?
Here is my troubleshooting:
1、I create a directory in my linux server under / as temp20190808.
2、then in jenkins file add sh 'ls / -l', there is no temp20190808,also the description of each file in ls form show differenly compare with original(there are details under).
3、using jenkins file, i create a file under / as jenkinstmp2019, then ls / -l, it's there, but after rm the code of creating jenkinstmp2019, then rebuild, ls / -l, jenkinstmp2019 no longer there, so the jenkins file system is a onetime job?
Here are code elaboration on point 1,2:
in my linux server, using ls / -l, there is a tmp20190808 i just created.
total 24
lrwxrwxrwx. 1 root root 7 Jun 19 16:53 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 Aug 1 04:55 boot
drwxr-xr-x. 17 root root 2860 Aug 7 02:48 dev
drwxr-xr-x. 86 root root 8192 Aug 7 20:52 etc
drwxr-xr-x. 4 root root 46 Jul 12 08:12 home
lrwxrwxrwx. 1 root root 7 Jun 19 16:53 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Jun 19 16:53 lib64 -> usr/lib64
drwxr-xr-x. 2 root root 6 Apr 11 2018 media
drwxr-xr-x. 2 root root 6 Apr 11 2018 mnt
drwxr-xr-x. 5 root root 53 Jul 23 08:11 opt
dr-xr-xr-x. 101 root root 0 Aug 7 02:47 proc
dr-xr-x---. 7 root root 215 Aug 6 02:53 root
drwxr-xr-x. 28 root root 920 Aug 8 02:03 run
lrwxrwxrwx. 1 root root 8 Jun 19 16:53 sbin -> usr/sbin
drwxr-xr-x. 2 root root 6 Apr 11 2018 srv
dr-xr-xr-x. 13 root root 0 Aug 7 02:47 sys
drwxr-xr-x. 2 root root 6 Aug 8 01:50 temp1
drwxrwxrwt. 20 root root 4096 Aug 8 02:23 tmp
drwxr-xr-x. 2 root root 22 Aug 8 01:39 tmp20190808
drwxr-xr-x. 13 root root 155 Jun 19 16:53 usr
drwxr-xr-x. 20 root root 4096 Jul 12 07:36 var
in jenkins.
total 8448
drwxr-xr-x. 1 root root 19 Jun 9 2016 bin
drwxr-xr-x. 2 root root 6 May 30 2016 boot
-rw-------. 1 root root 8646656 Jun 9 2016 core
drwxr-xr-x. 5 root root 360 Aug 8 01:58 dev
drwxr-xr-x. 1 root root 66 Aug 8 01:58 etc
drwxr-xr-x. 2 root root 6 May 30 2016 home
drwxr-xr-x. 1 root root 45 Jun 9 2016 lib
drwxr-xr-x. 2 root root 34 Jun 8 2016 lib64
drwxr-xr-x. 2 root root 6 Jun 8 2016 media
drwxr-xr-x. 2 root root 6 Jun 8 2016 mnt
drwxr-xr-x. 2 root root 6 Jun 8 2016 opt
dr-xr-xr-x. 123 root root 0 Aug 8 01:58 proc
drwx------. 1 root root 33 Aug 8 01:58 root
drwxr-xr-x. 3 root root 30 Jun 8 2016 run
drwxr-xr-x. 2 root root 4096 Jun 8 2016 sbin
drwxr-xr-x. 2 root root 6 Jun 8 2016 srv
dr-xr-xr-x. 13 root root 0 Aug 7 02:47 sys
drwxrwxrwt. 1 root root 29 Jun 9 2016 tmp
drwxr-xr-x. 1 root root 30 Jun 10 2016 usr
drwxr-xr-x. 1 root root 41 Jun 9 2016 var
As you can see, it's like two totally different linux server, but it's the same one.
So i'm wondering whether jenkins create a temp virtual file server to execute it's job, so can't access to original file except it's own directory.

Find out the reason by myself.
The real cause is agent, i before used agent { docker { image 'XXX' } }, which makes jenkins run its job on docker image.Then i change it to agent any, so job will run on the server jenkins is deployed on.

Related

How to flash MB1355C and/or MB1293C from the STM32WB55 Nucleo Pack on Linux?

I would like to program the (MB1355C and/or MB1293C) devices from an STM32WB55 Nucleo Pack on my (Ubuntu 18.04.3 LTS) machine - preferably with the convenience of an eclipse based IDE that supports debugging features.
I installed
STM32CubeProgrammer (version 2.2.1)
Atolic TrueStudio (version 9.3.0)
STM32CubeIDE (version 1.1.0)
and I now have the following udev rules
chandran#chandran-OptiPlex-9020:~$ ll /etc/udev/rules.d/
total 160
drwxr-xr-x 2 root root 4096 Dec 13 14:11 ./
drwxr-xr-x 4 root root 4096 Dec 4 13:44 ../
-rw-rw-r-- 1 root root 270 Oct 14 18:10 49-stlinkv1.rules
-rw-rw-r-- 1 root root 270 Oct 14 18:10 49-stlinkv1.rules.O
-rw-rw-r-- 1 root root 464 Oct 14 18:10 49-stlinkv2-1.rules
-rw-rw-r-- 1 root root 464 Oct 14 18:10 49-stlinkv2-1.rules.O
-rw-rw-r-- 1 root root 278 Oct 14 18:10 49-stlinkv2.rules
-rw-rw-r-- 1 root root 278 Oct 14 18:10 49-stlinkv2.rules.O
-rw-r--r-- 1 root root 458 Dec 11 17:26 49-stlinkv3loader.rules
-rw-rw-r-- 1 root root 845 Oct 14 18:10 49-stlinkv3.rules
-rw-rw-r-- 1 root root 845 Oct 14 18:10 49-stlinkv3.rules.O
-rw-r--r-- 1 root root 381 Dec 6 17:10 '#61-msp430uif.rules#'
-rw-r--r-- 1 root root 381 Dec 4 15:09 61-msp430uif.rules
-rwxr-xr-x 1 root root 2145 Dec 4 15:09 70-mm-no-ti-emulators.rules*
-rw-r--r-- 1 root root 58549 Dec 4 12:29 70-snap.core.rules
-rw-r--r-- 1 root root 79 Dec 5 12:11 77-msp430-blacklist.rules
-rw-r--r-- 1 root root 0 Dec 5 12:10 77-msp430-blacklist.rules~
-rw-rw-r-- 1 root root 18450 Oct 14 17:33 99-jlink.rules
-rw-rw-r-- 1 root root 18450 Oct 14 17:33 99-jlink.rules.O
I am in the dialout group
chandran#chandran-OptiPlex-9020:~$ groups chandran
chandran : chandran adm dialout cdrom sudo dip plugdev lpadmin sambashare
I downloaded an example project called STM32100E-EVAL_USART_IrDA_Transmit and it builds successfully, but I get the following error message when I connect the evaluation board(s) and click on debug to flash the micro controller
ST-Link enumeration failed
Error in initializing ST-Link device.
Reason: (2) ST-Link DLL error.
I get the same error message when I try the above with STM32CubeIDE.
I have tried shifting JP1 as described in section 7.6 of the users manual but to no avail.
A previous question on stack overflow deals with the same error message so I got STM32CubeProgrammer to launch and tried making the changes suggested by #IsaBostan, but the development boards don't seem to be detected
How can I proceed to resolve this problem and program the boards?
Debugging ideas or suggestions are welcome, even if they haven't been tested...
It was just a question of permissions as suggested by KamilCuk
Launching TrueStudio as root and then clicking on debug solved the problem.
This is what worked on my machine:
sudo su
/opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.3.0/ide/./TrueSTUDIO
STM32CubeIDE's debugger also works when launched as follows on my machine:
sudo su
/opt/st/stm32cubeide_1.1.0/./stm32cubeide
and STM32CubeProgrammer connects to the device straight away when launched as follows:
sudo su
/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/./STM32CubeProgrammer
My device shows up under /dev/ttyACM0 with the following permissions:
crw-rw----+ 1 root dialout 166, 0 Dec 28 11:56 ttyACM0
openocd and st-flash were not required.

`cd` to a folder in bash script not working: No such folder [duplicate]

This question already has answers here:
Why can't I change directories using "cd" in a script?
(33 answers)
'\r': command not found [duplicate]
(3 answers)
Closed 4 years ago.
This is my entire script. it is simply to avoid having to type it again and again
cd api
rails s -p 3001 -b 0.0.0.0
cd ..
When I am in the directory of the script and run cd api it works just fine. However when I run the script via ./start_server It does not work. Here is the output of ls -al:
mendel#DESKTOP-LIKG5E5:/mnt/c/Projects/chaverim-update$ ls -al
total 8
drwxrwxrwx 0 root root 512 Apr 13 12:32 .
drwxrwxrwx 0 root root 512 Apr 5 12:40 ..
drwxrwxrwx 0 root root 512 Apr 13 12:09 api
-rwxrwxrwx 1 root root 1237 Apr 5 12:40 boxfile.yml
drwxrwxrwx 0 root root 512 Apr 8 16:54 .bundle
drwxrwxrwx 0 root root 512 Apr 8 16:54 client
drwxrwxrwx 0 root root 512 Apr 13 12:09 .git
-rwxrwxrwx 1 root root 11 Apr 5 12:40 .gitignore
-rwxrwxrwx 1 root root 1097 Apr 5 12:40 LICENSE
drwxrwxrwx 0 root root 512 Apr 5 12:40 nginx
-rwxrwxrwx 1 root root 82 Apr 5 12:40 Procfile
-rwxrwxrwx 1 root root 67 Apr 5 12:40 README.md
-rwxrwxrwx 1 root root 188 Apr 5 12:40 run_tests
-rwxrwxrwx 1 root root 28 Apr 5 12:40 start_client
-rwxrwxrwx 1 root root 41 Apr 13 12:52 start_server
drwxrwxrwx 0 root root 512 Apr 8 16:54 vendor
As you can see there is a folder called api at the top and the start_server script is set to have execution permissions.

npm erased Plesk 12 on Ubuntu 16.04

My issue is pretty simple to explain and I guess hard to solve: I commited the stupidity of installing npm on a cloud based server with Ubuntu 16.04 with Plesk 12.
After reading this article I realized it was too late and after trying to connect to my Plesk GUI got an 403 error.
Also if I execute plesk on the CLI, it shows:
user#server:~$ plesk repair
plesk: command not found
So, I erased Plesk... All my hosted sites on Plesk are reachable with their databases in their URLs or by SSH.
The hosting provider told me there is no way to restore Plesk without losing everything unless I made a backup, but I didn't. Maybe there is an alternative... Do you know it?
Edit: Content of /var/lib/psa/dumps:
user#server:/var/lib/psa/dumps$ ls -lrta
total 5708
drwxr-xr-x 3 root root 4096 ene 4 2017 ..
-rw------- 1 root root 206315 ene 4 2017 mysql.preupgrade.12.0.18-12.0.18.20170104-173632.dump.gz
-rw------- 1 root root 3417 ene 4 2017 mysql.preupgrade.apsc.12.0.18-12.0.18.20170104-173633.dump.gz
-rw------- 1 root root 208481 ene 4 2017 mysql.preupgrade.12.0.18-12.5.30.20170104-174155.dump.gz
-rw------- 1 root root 3002 ene 4 2017 mysql.preupgrade.apsc.12.0.18-12.5.30.20170104-174156.dump.gz
-rw------- 1 root root 220725 ene 23 2017 mysql.preupgrade.12.5.30-12.5.30.20170123-062554.dump.gz
-rw------- 1 root root 3002 ene 23 2017 mysql.preupgrade.apsc.12.5.30-12.5.30.20170123-062556.dump.gz
-rw------- 1 root root 236736 feb 8 06:27 mysql.preupgrade.12.5.30-12.5.30.20170208-062713.dump.gz
-rw------- 1 root root 3003 feb 8 06:27 mysql.preupgrade.apsc.12.5.30-12.5.30.20170208-062715.dump.gz
-rw------- 1 root root 262580 feb 24 06:26 mysql.preupgrade.12.5.30-12.5.30.20170224-062621.dump.gz
-rw------- 1 root root 4603 feb 24 06:26 mysql.preupgrade.apsc.12.5.30-12.5.30.20170224-062623.dump.gz
-rw------- 1 root root 258785 mar 22 06:26 mysql.preupgrade.12.5.30-12.5.30.20170322-062626.dump.gz
-rw------- 1 root root 4898 mar 22 06:26 mysql.preupgrade.apsc.12.5.30-12.5.30.20170322-062627.dump.gz
-rw------- 1 root root 251339 abr 17 06:25 mysql.preupgrade.12.5.30-12.5.30.20170417-062540.dump.gz
-rw------- 1 root root 4899 abr 17 06:25 mysql.preupgrade.apsc.12.5.30-12.5.30.20170417-062543.dump.gz
-rw------- 1 root root 244219 may 16 06:25 mysql.preupgrade.12.5.30-12.5.30.20170516-062533.dump.gz
-rw------- 1 root root 4373 may 16 06:25 mysql.preupgrade.apsc.12.5.30-12.5.30.20170516-062535.dump.gz
-rw------- 1 root root 248044 jun 1 06:25 mysql.preupgrade.12.5.30-12.5.30.20170601-062529.dump.gz
-rw------- 1 root root 4381 jun 1 06:25 mysql.preupgrade.apsc.12.5.30-12.5.30.20170601-062530.dump.gz
-rw------- 1 root root 273341 jul 17 06:25 mysql.preupgrade.12.5.30-12.5.30.20170717-062542.dump.gz
-rw------- 1 root root 4379 jul 17 06:25 mysql.preupgrade.apsc.12.5.30-12.5.30.20170717-062544.dump.gz
-rw------- 1 root root 367277 jul 20 06:26 mysql.daily.dump.8.gz
-rw------- 1 root root 367218 jul 21 06:25 mysql.daily.dump.7.gz
-rw------- 1 root root 368954 jul 22 06:25 mysql.daily.dump.6.gz
-rw------- 1 root root 369279 jul 23 06:25 mysql.daily.dump.5.gz
-rw------- 1 root root 368767 jul 24 06:25 mysql.daily.dump.4.gz
-rw------- 1 root root 369629 jul 25 06:26 mysql.daily.dump.3.gz
-rw------- 1 root root 370169 jul 26 06:25 mysql.daily.dump.2.gz
-rw------- 1 root root 368027 jul 27 06:25 mysql.daily.dump.1.gz
-rw------- 1 root root 368128 jul 28 06:26 mysql.daily.dump.0.gz
drwxr-xr-x 2 psaadm psaadm 4096 jul 29 01:32 .
-rw------- 1 root root 20 jul 29 01:32 mysql.plesk.core.prerm.12.5.30.20170729-013250.dump.gz
First of all, I recommend to change the hosting provider, as their answer is incorrect and it seems, that they don't have much experience with Plesk, nor do they seem to have much knowledge about Plesk.
Second, your statements are a bit unclear, as you state:
although I made a backup
and directly afterwards you stated:
and I didn't
Could you pls. clarify WHAT you did and what you forgot to do?
Third, pls. have a look at => "/var/lib/psa/dumps" and inform us about the possible content.
Fourth, if you have dumps located at "/var/lib/psa/dumps", you will always have the choice to re-install Plesk and to re-import the latest "psa", "mysql" and "horde" - databases from your dumps. How to restore a Plesk database dump is explained at:
=> https://support.plesk.com/hc/en-us/articles/213904125
If you have further Plesk related questions, I recommend a new thread at the official Plesk Community Forum ( => https://talk.plesk.com ) , where experienced Plesk users will help you with Plesk - related questions/issues/errors/problems! ;-)

Searching shared libraries in Linux

please explain me why on x86_64 Scientific Linux no file under /etc/ld.so.conf.d contains the directory /usr/lib64?
The list of directories to be searched by program loader is stored in the file /etc/ld.so.conf. On my distributive, this file stores this row: include ld.so.conf.d/.conf*
And the above directory consists of:
[root#dev_host build]$ ls -la /etc/ld.so.conf.d
total 36
drwxr-xr-x. 2 root root 4096 Aug 29 23:13 .
drwxr-xr-x. 103 root root 12288 Sep 18 03:41 ..
-rw-r--r--. 1 root root 17 Mar 20 2012 atlas-x86_64.conf
-r--r--r--. 1 root root 324 May 7 23:40 kernel-2.6.32-431.17.1.el6.x86_64.conf
-r--r--r--. 1 root root 324 Nov 22 2013 kernel-2.6.32-431.el6.x86_64.conf
-rw-r--r--. 1 root root 17 Feb 12 2014 mysql-x86_64.conf
lrwxrwxrwx 1 root root 31 Aug 11 14:46 postgresql-pgdg-libs.conf -> /etc/alternatives/pgsql-ld-conf
-rw-r--r--. 1 root root 22 Sep 7 2011 qt-x86_64.conf
I examined all these files - there is no /usr/lib64. Why? Is it stored in /etc/ld.so.cache?

CHROOT : Allowing outside access to chrooted users with mount bind

I have a chrooted user(username: clientdev) which I have jailed inside their home directory. This chroot directory is /home/clientdev/ which is owned by root.
Now I need this clientdev user to be able access the tomcat web application folder which is residing under /mnt/datadrive/tomcat/webapps.
What I have done is :
chroot the user with a public key of their own to the home
directory.
Create a folder under /home/clientdev called tomcat_ROOT and gave
the ownership to clientdev.
Now when I run the command :
mount -bind /mnn/datadrive/tomcat/webapps /home/clientdev/tomcat_ROOT
The folder disappears from the directory listing inside /home/clientdev if I login with clientdev. My root user can see it but now the desired user.
Any help would be greatly appreciated
Thanks in advance,
Peter
Output of ls -l /home/clientdev/tomcat_ROOT:
drwxr-xr-x. 6 root root 4096 Apr 11 15:07 .
drwxrwxr-x. 12 root root 4096 Apr 11 15:07 ..
drwxr-xr-x. 3 root root 4096 Apr 9 22:10 webapp1
drwxr-xr-x. 4 root root 4096 Mar 18 18:43 webapp2
drwxr-xr-x. 3 root root 4096 Apr 9 22:11 webapp3
drwxrwxr-x. 10 root root 4096 Apr 11 15:20 ROOT
Output of ls -l /home/clientdev/:
drwx------. 4 clientdev clientdev 4096 Apr 10 21:36 .
drwxr-xr-x. 7 root root 4096 Apr 10 22:07 ..
-rw-------. 1 clientdev clientdev 664 Apr 10 21:43 .bash_history
-rw-r--r--. 1 clientdev clientdev 18 Apr 23 2012 .bash_logout
-rw-r--r--. 1 clientdev clientdev 176 Apr 23 2012 .bash_profile
-rw-r--r--. 1 clientdev clientdev 124 Apr 23 2012 .bashrc
drwx------. 2 clientdev clientdev 4096 Apr 10 19:20 .ssh
drwxr-xr-x. 2 clientdev clientdev 4096 Apr 10 21:34 tomcat_ROOT

Resources