You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
760 B

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2017 OpenWrt.org
  3. USE_PROCD=1
  4. START=90
  5. STOP=10
  6. PROG=/usr/sbin/i2pd
  7. USER="i2pd"
  8. GROUP="i2pd"
  9. PIDFILE=/var/run/i2pd.pid
  10. DATADIR=/etc/i2pd
  11. PEERDIR=/var/lib/i2pd/peerProfiles
  12. start_service() {
  13. ## RAM
  14. if [ ! -d $PEERDIR ]; then
  15. mkdir -p $PEERDIR
  16. chown $USER:$GROUP $PEERDIR
  17. fi
  18. ## We need permissions
  19. chown -R $USER:$GROUP $DATADIR
  20. touch $PIDFILE
  21. chown $USER:adm $PIDFILE
  22. procd_open_instance
  23. procd_set_param command $PROG --service --conf=/etc/i2pd/i2pd.conf
  24. ## Don't know about i2pd user's HOME
  25. procd_set_param env HOME=$DATADIR
  26. procd_set_param limits nofile=4096
  27. procd_set_param stdout 1
  28. procd_set_param stderr 1
  29. procd_set_param user $USER
  30. procd_set_param pidfile $PIDFILE
  31. procd_close_instance
  32. }