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.

44 lines
1.2 KiB

  1. #!/bin/sh /etc/rc.common
  2. USE_PROCD=1
  3. BOINCEXE_NAME=boinc_client
  4. BOINCDIR=/opt/boinc/
  5. BOINCUSR=boinc
  6. BOINCEXE_OPTS="--check_all_logins --redirectio --dir $BOINCDIR"
  7. PID_FILE="var/run/$BOINCEXE_NAME.pid"
  8. start_service() {
  9. # First Check that BOINCDIR exists...
  10. if ! [ -d "$BOINCDIR" ]; then
  11. if ! mkdir -p $BOINCDIR 2>/dev/null ; then
  12. echo "ERROR: $BOINCDIR doesn't exist and couldn't be created"
  13. return 1
  14. fi
  15. fi
  16. # ... and that it is accessible by boinc
  17. BOINCDIR_OWNER="$(ls -ld $BOINCDIR | awk '{print $3}')"
  18. if [ "$BOINCUSR" != "$BOINCDIR_OWNER" ] ; then
  19. chown -R $BOINCUSR:$BOINCUSR $BOINCDIR
  20. BOINCDIR_OWNER="$(ls -ld $BOINCDIR | awk '{print $3}')"
  21. if [ "$BOINCUSR" != "$BOINCDIR_OWNER" ] ; then
  22. echo "User boinc can't access $BOINC_DIR"
  23. return 3
  24. fi
  25. fi
  26. # now use procd to start boinc
  27. procd_open_instance $BOINCEXE_NAME
  28. procd_set_param command $BOINCEXE_NAME
  29. procd_append_param command $BOINCEXE_OPTS
  30. procd_set_param user $BOINCUSR
  31. procd_set_param limits core="unlimited"
  32. procd_set_param stdout 1
  33. procd_set_param stderr 1
  34. procd_set_param pidfile $PID_FILE
  35. procd_close_instance
  36. }