Search code examples
shellubuntudaemon

Shell script to call daemon - DAEMON: command not found


Currently I can start a custom server like this:

cd /home/admin/service/build && ./service visual.dat

I'm trying to make a shell script to make a daemon. I tried many things...

#!/bin/sh -e
cd /home/admin/service/build
DAEMON = "./service"
daemon_OPT="service.dat"
...

The response is:

admin@service:~$ sudo /etc/init.d/servicedaemon start
/etc/init.d/servicedaemon: line 3: DAEMON: command not found

Well, how to launch the service from the daemon like I did from the shell ? It's probably a path issue. Thanks in advance.


Solution

  • I think you have to remove the spaces around "=":

    DAEMON="./service"
    

    Now it seems that it tries to run a command called DAEMON instead of the actual application.