What's new

Entware How to pass Environment variables in init.d scripts?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

gjf

Senior Member
Hi all.

My main intention is to use SOCKS5 server opened on my router for all tracker connections in Transmission.
As last versions of Transmission relies entirely on libcurl, I need to pass environment variable to use the corresponding proxy.
On Linux systems I need to edit a corresponding systemd script like
Code:
vim /lib/systemd/system/transmission-daemon.service
...
[Service]
Environment="ALL_PROXY=socks5://192.168.111.1:1080"
...
However Asus Merlin uses init.d script to start Transmission so I have something like
#!/bin/sh

ENABLED=yes
PROCS=transmission-daemon
ARGS="-g /opt/etc/transmission"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

TRANSMISSION_WEB_HOME="/opt/share/transmission/web"

. /opt/etc/init.d/rc.func
My question is: how to set environment variable in init.d to be used in transmission only (not system-wide)?
 
Hi all.

My main intention is to use SOCKS5 server opened on my router for all tracker connections in Transmission.
As last versions of Transmission relies entirely on libcurl, I need to pass environment variable to use the corresponding proxy.
On Linux systems I need to edit a corresponding systemd script like
Code:
vim /lib/systemd/system/transmission-daemon.service

However Asus Merlin uses init.d script to start Transmission so I have something like

My question is: how to set environment variable in init.d to be used in transmission only (not system-wide)?
Just add it to that script like the other variables that are already there.
 
  • Like
Reactions: gjf
Just add it to that script like the other variables that are already there.
Do you mean I just need to edit corresponding init.d script into
#!/bin/sh

ENABLED=yes
PROCS=transmission-daemon
ARGS="-g /opt/etc/transmission"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ALL_PROXY=socks5://192.168.111.1:1080
TRANSMISSION_WEB_HOME="/opt/share/transmission/web"

. /opt/etc/init.d/rc.func
If so, will it affect other application those possibly use libcurl? I mean: such variable will be global or local?
 
Do you mean I just need to edit corresponding init.d script into
Yes.
If so, will it affect other application those possibly use libcurl? I mean: such variable will be global or local?
No, because that script (which I assume is actually called S88transmission) is only used to start Transmission. Other Entware packages have their own startup scripts.
 
  • Like
Reactions: gjf

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top