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

Raspberry Pi --uid issue #99

Open
imsunburnt opened this issue Jan 2, 2018 · 0 comments
Open

Raspberry Pi --uid issue #99

imsunburnt opened this issue Jan 2, 2018 · 0 comments

Comments

@imsunburnt
Copy link

imsunburnt commented Jan 2, 2018

When running on Raspberry Pi Jessie lite I had to add quotes around the --uid option in file templates/sysvinit/initd.template. According to forever -help:
--uid Process uid, useful as a namespace for processes (must wrap in a string)
e.g. forever start --uid "production" app.js

Without adding the quotes the command:
sudo service service-name stop
would not stop the service.

I did not verify if this problem exists in Ubuntu.

I made the following changes in templates/sysvinit/initd.template (in two places):
FROM: --uid {{service}}
TO: --uid "{{service}}"

SNIPPET:
{% if runAsUser %}
touch $LOGFILE
chown {{runAsUser}} $LOGFILE

{{suprog}} - {{runAsUser}} -c "\
export FOREVER_ROOT={{foreverRoot}};\
{% if envVarsNameValueArray|default(false) %}{% for v in envVarsNameValueArray %}export {{ v[0] }}=$(printf "%q" {{v[1]}});\{% endfor %}{% else %}\{% endif %}
cd {{cwd}};\{% if applyUlimits %}
ulimit -f unlimited;\
ulimit -t unlimited;\
ulimit -v unlimited;\
ulimit -n 64000;\
ulimit -m unlimited;\
ulimit -u 32000;\{% endif %}
{{foreverPath}}forever \
	-a \
	-l $LOGFILE \
	--minUptime $MIN_UPTIME \
	--spinSleepTime $SPIN_SLEEP_TIME \
	--killSignal $KILL_SIGNAL \
	{{foreverOptions|default('')}} \
	--uid "{{service}}" \    <=========== added quotes ===================
	start {{script|default('app.js')}} {{scriptOptions|default('')}}" 2>&1 >/dev/null
{% else %}
# move to the directory from where the inital forever script was launched so that even if it is relative it works as expected
cd {{cwd}}

{% if applyUlimits %}
ulimit -f unlimited
ulimit -t unlimited
ulimit -v unlimited
ulimit -n 64000
ulimit -m unlimited
ulimit -u 32000
{% endif %}

{{foreverPath}}forever \
-a \
-l $LOGFILE \
--minUptime $MIN_UPTIME \
--spinSleepTime $SPIN_SLEEP_TIME \
--killSignal $KILL_SIGNAL \
{{foreverOptions|default('')}} \
--uid "{{service}}" \   <=========== added quotes ================
start {{script|default('app.js')}} {{scriptOptions|default('')}} 2>&1 >/dev/null
{% endif %}
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

1 participant