Getting 'command not found' when running daemon in unix - unix

I am attempting to run the script Daemon.php from a unix prompt as a daemon using the code below as per the instructions given in this tutorial.
daemon Daemon.php --log=/var/log/Daemon.log
When I run this I get the output
daemon: command not found
Does know what might be going wrong?

Try daemonize instead. If that also isn't found on your system, simply start Daemon.php in the background and see how far you get.

Related

Getting error "you must have a tty to run sudo" when we run through Pentaho

I am getting a you must have a tty to run sudo error when I run a shell script with a R script in it.
Weird thing is, it doesn't happen every time. I think it is because of RAM issue, but I am not sure.
This means that you are running on a Linux distribution with 'sudo' configured to require a tty.
Please refer this link for an easy fix:
https://www.shell-tips.com/2014/09/08/sudo-sorry-you-must-have-a-tty-to-run-sudo/

ASP.NET vNext DNX: Command not found when run from a script? Probably a path issue?

I'm trying to run an ASP.NET vNext project on a Linux server, and even though I can start it from command line easily I cannot add the command to start it to "/etc/rc.local" because when the system starts it says "Could not find the command DNX." In an attempt to fix this, I tried to make a script (start.sh) the start the server, so that I could call the script from /etc/rc.local instead. Running the script gives the same error, but I can still copy the content of the script itself into the command line to get the exact same effect.
Here's a copy of the result of "echo $PATH":
/root/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-rc1-final/bin:/root/.dnx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
The solution was to use the full path in my script.

How to get the daemon Rserve running as worker dyno on Heroku

This question is an obscure problem - sorry for the length. I'm trying to deploy an app to Heroku. The app runs Rserve - a daemon of the R language, for running statistical reports. This should in principle be no more difficult than getting any daemon, such as memcached, to run in Heroku.
In Mac OSX I just start the daemon in the command line and forget it - all works fine. I'm interfacing with Rserve from node.js, using https://github.com/albertosantini/node-rio (not a factor here though).
But in deploying to Heroku, not having much luck. I'm using a multipack of R and node. Installation runs fine, all build steps exit okay, R starts fine.
Now comes the job of starting the Rserve daemon on the worker dyno.
My procfile looks like this:
web: node server.js
worker: R CMD Rserve --no-save
When I run it, I get the following error in the logs (scroll to end of block):
Rserv started in daemon mode.
heroku[worker.1]: State changed from starting to crashed
The Rserve() config docs are here: http://www.rforge.net/Rserve/doc.html I am not expert at configuring it but perhaps there is something in there that I should be doing for it to work in this environment?
An oddity is that you can run this without error from the Heroku run console, but (see below), it does not seem to actually be running when I try to access it from node.js:
heroku run R CMD Rserve
[Previously saved workspace restored]
Rserv started in daemon mode.
>
In node.js (heroku run node), I try testing it thus:
var rio = require('rio');
rio.evaluate("pi / 2 * 2");
which gives the error "Rserve call failed".
This leads me to think something is fundamentally wrong with what I am trying to do or how I am trying to do it.
Rserve runs as a daemon by default, so use a script to execute it so it runs "in process".
E.g.
# example R script for executing Rserve
require('Rserve')
# get the port from environment (heroku)
port <- Sys.getenv('PORT')
# run Rserve in process
run.Rserve(debug = FALSE, port, args = NULL, config.file = "rserve.conf")
And then your Procfile will have an entry as follows:
rserve: R -f rserve.r --gui-none --no-save
So I tried a dozen ways to get it started on a worker dyno, but all would crash. I never got to the bottom of all environment issues - I am not very expert at Unix. However... I did get it work by spawning a child process to run Rserve at the end of my server.js initialization script on my web dyno. It works.
childProcess.exec('R CMD Rserve --no-save', function (error, stdout, stderr) {});
My plan is to implement it this way in the worker process and use Web Workers to communicate between the separate environments.

Riak not starting

I have installed riak and erlang as mentioned in the basho website.
But when i try to start riak with the command:
/etc/init.d/riak start
or
service riak start
I get the following error:
Starting Riak: Riak failed to start within 15 seconds,
see the output of 'riak console' for more information.
If you want to wait longer, set the environment variable
WAIT_FOR_ERLANG to the number of seconds to wait
I also checked with the command: riak ping, which gave the error:
Attempting to restart script through sudo -H -u riak
Node 'riak#sys_ip' not responding to pings
I am using 64 bit Centos 6.3 machine. Can anybody help me with this?
Initially when i had installed riak and checked the status, it showed that riak had started. Somewhere during the experimentation, it has stopped working. Not able to find, as to what might be the reason?
Thanks
Thanks all ! I found the solution to my problem. I was running the commands as root user. When I tried using the same commands as non-root user with sudo prefix, everything just worked fine ! :)
Try running following command, it runs diagnostic test over configuration settings and gives more verbose information if there is anything wrong.
riak console
riak start by default doesn't give verbose information about the issue. In my case issue was - missing write permissions on directory - /var/lib/riak/generated.configs.
As you didn't mention any version of Erlang, I would like to inform you that using Erlang R15B02 causes error with riak-admin status.It's better to use Erlang R15B01 with Riak 1.2 and 1.2.1. Riak 1.0 requires Erlang R15B03 and later versions.So, check whether you have installed compatible versions.And if that's not the issue, here is the same issue as yours. Riak - Riak failed to start within 15 seconds,

How do I use Monit to keep an R script running?

I have an R script that I want to have running continuously on Ubuntu 10.10. I'm trying to setup Monit to ensure that it doesn't go down. As the script starts, it creates a pid file with the lines:
pid <- max(system("pgrep -x R", intern = TRUE))
write(pid, "/var/run/myscript.pid")
Then I've set up Monit with the lines:
check process myscript with pidfile /var/run/myscript.pid
start program = "/usr/bin/R --vanilla < /home/me/myscript.R > /home/me/myscript.out 2>&1"
Monit starts fine, but when I kill the R process, the R process is not started up again. I'm obviously doing something wrong. Is it in the syntax for starting the process? I noticed that the documentation says Monit first tries to stop the programme and I don't know any commands for stopping an R process.
Perhaps of relevance is that the above line for starting the program works when it is in the crontab for the root user, but not when started from my user crontab.
Any guidance greatly appreciated.
I can't comment about Monit, but there is a good article by Andrew Robinson in R News about using linux/unix tools to monitor R . In particular, screen and mail might be useful for your application.

Resources