nohup error no such file or directory
The usual problem with scripts that run from the command line and not when run by cron
is 'environment'. There are many questions on SO where this is exemplified, including:
- Perl script works but not when via cron
- Why does my command line not run from cron?
- Bash script not executing in cron correctly
- How can I set environment variables that crontab will use?
For debugging purposes, add a command/line to the cron-run script that does:
env > /tmp/cron.job
Review whether the PATH there includes what you expect, and in particular, whether it includes the directory (directories) where each of the three programs is installed. And do check that you run the programs you expect from the command line:
which vmpstat mpstat iostat
It is a reasonable guess that the two 'missing' commands are not in a directory on PATH when your script is run by cron
. And cron
gives you a bare minimal environment; it is completely unlike at
in that respect.
See also:
- Crontab and testing a command to be executed
- How do I add pre-hook and post-hook scripts that run before all of my cron jobs?
No such file or directory error when I try to run a Linux script written from Windows system
The below line in your output indicates you're having dos line-endings "CR - Carriage returns" in your file.
with CRLF line terminators
Try running cat -v your_file
, if it shows ^M at the end of each line you'd need to run dos2unix
on them, eg dos2unix your_file
to convert them to unix format
Running a JMeter script with nohup giving No such file or directory
I'm not fully getting what you're trying to achieve, the correct equivalent of your command would be something like:
nohup bash -c "JVM_ARGS=\"-Xms1024m -Xmx2048m\" && export JVM_ARGS && ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 & ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 & ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01" 2>&1 &
If the only concern is network connectivity loss between putty, whatever it is, and Linux Azure VM you could use a terminal multiplexer like screen or tmux on the Azure VM side so you can attach to the running session when needed from this or another machine.
There are also a lot of ways to schedule a Linux job starting from simplest cron definitions, systemd timers or you can use a "heavy artillery" like Jenkins which allows flexible scheduling and kicking off jobs on other triggers. If you go for Jenkins you can enjoy the benefits of the Performance Plugin allowing marking builds as failed or unstable depending on test metrics received and plotting performance trend charts
Shell node: No such file or directory
I would like to thank @Florian Schlag for helping me reach the answer and giving me the correct answer. I have pasted my file below for reference. Please note that I had to change some files around but these can be deduced from output npm errors.
#!/bin/bash
PATH=$PATH:/home/<user>/bin/
NPM="`which npm`"
if [ "x" == "x$NPM" ]; then
(>&2 echo "NPM not installed")
exit 1
fi
pID=$(pgrep "PM2" -f)
if [ -n "${pID}" ];
then
exit 0
else
# start it
echo "restarting"
nohup $NPM start ./<file path ton script> --production &
fi
Related Topics
Apache/Httpd /Var/Www/HTML/ .Cgi Scripts Throw 500 Internal Server Error
Can't Install Using Yum in Rhel 7.1
Reason of a Directory Size Being Zero
What Is a Good Interface for a Linux Device Driver for a Co-Processing Peripheral
Docker Rootless Unable to Pull Images
How to Make Fork Changes Reflect with The Master When Updated
How to Change Port Gitlab on Centos 6
Using Curl with Commands in Go
How to Execute a Command in a Bash Script and Then Focus The Appearing Window
Building Robert Nelson's Linux Kernel into Yocto(Daisy) for Beaglebone Black
Understanding The Netstat Output
Touch Command Create Multiple Files (Different Names) Under One Directory
Linux Kernel Hardware Break Points
Finding and Listing Duplicate Words in a Plain Text File
Mmap /Dev/Fb0 Fails with "Invalid Argument"