Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start as initd service throught symlink fails #382

Open
deiv opened this issue Jan 21, 2020 · 4 comments
Open

Start as initd service throught symlink fails #382

deiv opened this issue Jan 21, 2020 · 4 comments

Comments

@deiv
Copy link

deiv commented Jan 21, 2020

If jqm.sh is symlinked in /etc/init.d (as documentation states):

ln -s $JQM_ROOT/jqm.sh /etc/init.d/jqm

And started as root. It fails because the relaunching of the script, cant resolve the real filename of the script. Affected code:

if [ $(whoami) = "root" ]
then
    if [ "x${JQM_SERVICE_ACCOUNT}" = "x" ]
    then
        echo "Defaulting to account jqm for running the script. Set JQM_SERVICE_ACCOUNT to use a different account."
        JQM_SERVICE_ACCOUNT="jqm"
    fi
    echo "Re-launching script as ${JQM_SERVICE_ACCOUNT}"
    su - ${JQM_SERVICE_ACCOUNT} -c "export JQM_NODE=\${JQM_NODE:-${JQM_NODE}}; $(pwd -P)/$(basename $0) $*"
    exit $?
fi

It's failing because $(basename $0) it getting resolved as jqm not jqm.sh.

Thanks,

@tuxella
Copy link
Contributor

tuxella commented Jan 22, 2020

Could you give the exact error message you get and the shell used by the JQM_SERVICE_ACCOUNT account?

@deiv
Copy link
Author

deiv commented Jan 22, 2020

Hi,

Error and shell:
-bash: /home/jqm/jqm-2.2.2/jqm: No existe el fichero o el directorio

In my setup, I have the following soft links:

  • ln -s $JQM_ROOT/jqm.sh /etc/init.d/jqm
  • /home/jqm/jqm -> /home/jqm/jqm-2.2.2 (where $JQM_ROOT = /home/jqm/jqm)

@tuxella
Copy link
Contributor

tuxella commented Jan 22, 2020

I just tested, this should work ok.

Can you check /etc/init.d/jqm actually links to the shell script with \ls -l /etc/init.d/jqm ?

@deiv
Copy link
Author

deiv commented Jan 23, 2020

Here we go:

lrwxrwxrwx 1 root root 20 Jan 22 11:42 /etc/init.d/jqm -> /home/jqm/jqm/jqm.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants