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.

53 lines
1.4 KiB

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