I have read related answers on StackOverflow about my question. But the problem outlined by my question seems to be different.
If I schedule a CRON job with the following command, it works perfectly fine.
/path/to/phantomjs -v
However if I replace the '-v' in the above command with the path to a script file, it does not seem to work at all.
/path/to/phantomjs /path/to/script.js
I have verified that the path to script.js is correct. I am at loss why the script does not run when the executable prints the current version fine.
Related
I'm having an issue with WSL2:
$ where b4a
/usr/local/bin/b4a
$ b4a new
/usr/local/bin/b4a: 1: Not: not found
Even though where finds commands, I can't run them. And it's not a PATH issue either:
echo $PATH
/usr/local/sbin:/usr/local/bin:[...]
And b4a isn't the only command with this problem. What could be the cause? My distribution is Debian 10 and host is Windows 10.
Not necessarily a full answer, but hopefully the troubleshooting methods you need to arrive at a solution ...
Note that it doesn't say that the command itself isn't found. For instance, if you run:
# lllllllllll
lllllllllll: command not found
That's truly a command not found. This is different. While I don't (yet) know the exact cause, this seems closer to the issues we might see with improperly quoted paths with spaces in a shell script.
You mention that other commands have this problem -- Is there something in common with the commands that don't work properly? Is it possible that they are all shell scripts?
Try several things to debug:
Start WSL without your startup profile. It's very likely that something (or you) added a line that is causing problems. From PowerShell or CMD:
wsl ~ -e bash --noprofile --norc
b4a
If that works, then there's a problem in one of your startup files that you'll need to debug. Look for anything modifying environment variables without proper quoting, especially the PATH. WSL automatically appends the Windows path to your Linux path to make it easy to run Windows commands, but the fact that almost every Windows path has spaces in it can cause problems for unsuspecting scripters that don't take this corner case into account.
Having a space in a path is fully allowed in Linux, but some scripts just don't handle it properly.
If the command that is failing is a shell script, trying starting it with:
bash -x /usr/local/bin/b4a
Or even start WSL with wsl ~ -e bash -x to see all trace output from the shell.
In this case, you'll be looking for some problem in the script right around where it actually fails.
If all else fails, you can disable WSL's PATH modification via its config file:
sudo -e /etc/wsl.conf
Add the following:
[interop]
appendWindowsPath = false
Then exit Debian, run wsl --shutdown and restart Debian. Try the b4a command again.
If this works, then the problem is almost certainly due to some problem in the PATH quoting in these commands. I don't recommend it as a permanent solution since you will have to type out the full path of Windows applications each time you want to run them.
So I have a script that is launched on login via rc.local. The script calls a few other scripts to be launched and ran. However the console says that the file and/or directories could not be found. When I run the script manually after the login it works just fine. I have even tried to add a small delay so that I know that the system logged in. Any idea why this is and how to fix it?
Sorry if my answer is a bit vague but from what I understand is that the scripts require to be run via admin privileges. Let me elaborate, when the system starts it runs a set of specific scripts and this differs from distro to distro. Therefore, I'd check ~/.bashrc /etc/profile.dand most importantly ~/.bash_login. See what you can do there. Personally I added it here ~/.config/autostart worked fine. Don't forget to create a .desktop file.
Hope this helps
Just got emacs24.4 compiled and try to run it in daemon mode.
OS: Ubuntu 14.04
In terminal:
When I run it with "emacs -Q --daemon" everything works fine. But when I run it with "emacs --daemon", it doesn't return to shell (emacs24.3 works fine).
Is there any easy way to debug what's wrong in the init file which works fine for 24.3 but not 24.4?
Recursively bisect your init file, to find out what the culprit code is. You can do this by commenting out 1/2 of it, then 3/4 of it, then 7/8, then 15/16,... IOW, a binary search - it is very quick.
You can use command comment-region to comment or (with C-u) to uncomment the region. (I bind it to C-x C-;.)
Then remember this answer. It applies to any problem introduced by your init file.
Everything in your question that has to do with "Emacs 24.4" and "daemon" and "shell" only becomes relevant (if it is) after you have narrowed things down to find just what code is responsible for introducing the bad behavior.Once you do that, if the solution to what remains is not obvious, then please post another (new) question here that covers the relevant info, whether it be Emacs 24.4, shell, daemon, or whatever.
I'm trying to run PhantomJS from a Grails application running on a Tomcat 7 instance on Linux (Ubuntu 13.04).
I'm sure PhantomJS is installed correctly because I can execute it from the command line. I'm using it to make a screen capture of a web page (http://phantomjs.org/screen-capture.html).
When I run the command from the command line, it works great, using user root:
phantomjs /home/user/captureScreen.js "http://xx.xx.xx.xx/chart" "/home/user/07012014050636114.png"
I believe there is no need to share the JS code since it's working fine from the command line.
The problem is that when I run the same command from the web-app (Grails), it just returns with a 0 value, which tells me everything ran fine, but it's not creating the PNG file neither returning an error.
I'm calling the command from Groovy, this way:
String path = "phantomjs pathToJs.... etc"
def process = path.execute()
process.waitForOrKil(5000) // This runs in 1 to 2 seconds in the command line
println process.exitValue()
I tried adding write permissions to the tomcat7 user to the folder where the JS file and where the image is written but still it didn't work but I still believe it's something related to permissions
Any thoughts?
Thanks!
As for command execution, we experienced problem in Grails applications concerning pure string notation. Using the array syntax
["/usr/binphantom/js","/home/user/captureScreen.js","http://xx.xx.xx.xx/chart","/home/user/07012014050636114.png"].execute()
made the thing work. I think it has to do with shell expansion which differs on how strings are handled in Groovy.
I am following this tutorial that is like the hello world for post-commit
I am using Ubuntu 10.04. I installed svnnotify and ran $ which svnnotify which output:
/usr/bin/svnnotify
so I changed the path in the turorial from /usr/local/bin/svnnotify to /usr/bin/svnnotify
I also tried changing the line: #!/bin/sh to #!/bin/bash since bash is the login shell in ubuntu 10.04.
I tried to run it the way the tutorial originally had it, with my changes, and combinations of the two.
Every time the commit is successful but I get
Warning: post-commit hook failed (exit code 1) with no output.
The original way had output not found
I am very new to linux and shell scripting and have exhausted everything I can think of. What am I doing wrong?
Get the script working and tested before trying to run as a commit hook. I expect that your problem is something to do with the script, maybe not being marked as executable, environment wrong, etc.. i.e. if you can't get it to run successfully from the command line, this is more of a unix/shell question and doesn't really have anything to do with SVN (yet).
I'm not sure whether this applies in the Linux world, but in the Windows versions of SVN I've used, the code which runs the hook scripts only captures STDERR. If your hook script is only writing messages to STDOUT, that would likely explain the "No Output" warning.