ircd.initd 799 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2022 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. depend() {
  5. use net
  6. }
  7. start() {
  8. PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
  9. ebegin "Starting ircd"
  10. env TERM="xterm" \
  11. start-stop-daemon \
  12. --start \
  13. --make-pidfile \
  14. --pidfile /var/run/ircd.pid \
  15. --background \
  16. --user $USER \
  17. --env HOME="${PWHOME:-/home/$USER}" \
  18. --name ircd \
  19. --exec /usr/bin/screen -- -D -m -S ircd /usr/local/bin/ircd
  20. eend $?
  21. }
  22. stop() {
  23. ebegin "Stopping ircd"
  24. # Because we've daemonized with screen, we need to replace the PID file
  25. # with the real PID of the program
  26. pgrep -P $(cat /var/run/ircd.pid) > /var/run/ircd.pid
  27. start-stop-daemon --stop --signal 15 \
  28. --pidfile /var/run/ircd.pid
  29. eend $?
  30. }