0

I have some ‍upload/download ruby scripts; I want to run those scripts in daemon process. When I run ruby script on terminal, it ask for some input after that script start to execute. So now I want to run this scripts using daemon process. But the problem is that how can I give input to scripts, so that it executes.

It would be good if there is solution in which we have to enter the password and then the daemon can continue without any further input until you need to restart it.

If it's not possible, then it would be good to make the input a command line parameter to the daemon running script(clockwork).

I'm using ubuntu12.04 and clockwork gem to start daemon process.

1

A daemon normally runs without interaction. Given that there is the problem of how to provide a password that you don't want to keep in a configuration or startup file for the daemon.

What I have done in these kind of situation is:

  1. Have the daemon look for a file under /root/ as long as it doesn't have the password every 10 seconds. Writing every 10 minutes to the system log that it is running, but cannot proceed.
  2. Have an option for the daemon program that when used prompts for the password and writes the password to the correct file
  3. Once the file exists the daemon reads the contents and removes the file.

As /root is normally relatively unreadable by others this was secure enough for my setup. You could check for the /root permissions and decline to write the file if they are not 700.

If the passwords are checked in the sources (instead of handed to some program that might need them), then make sure those cannot be read by anyone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.