• Welcome to BOINC-AUSTRALIA FORUM.

News:

Once you registration is approved you will see all the Boards on the Forum.  Non members of the forum only see the Public topics

Main Menu

How to start BOINC from command line

Started by jave808, July 14, 2021, 03:26:50 PM

jave808

Hi all

I'm trying to write some very simple scripts for starting/stopping boinc.

To stop, I have boinccmd --quit
This kills all the WUs and leaves boincmgr open.

How do I do the same thing but in reverse, ie to start all WUs that were processing previously?  boincmgr is still open.
PC1: Intel Xeon E5-2697v3, 64GB DDR4 ECC, Quadro M5000 & M4000, Linux Mint 22.3 Cinnamon
PC2: AMD Ryzen 7 5825U, 32GB DDR4, Radeon Graphics, Win11 Pro 26H2
PC3: AMD Ryzen 7 6800H, 32GB DDR5, Radeon Vega Mobile Graphics, Ubuntu 26.04.1 Cinnamon

Dingo

I do not use commands in Windows just BoincTasks that does all that on one or many computers.

If you want scripts to stop and start BOINC on Linux or Raspberry Pi I can help you out.







Have a look at the BOINC@AUSTRALIA

Facebook Page and join and also the Twitter Page.

Proud Founder and member of BOINC@AUSTRALIA
My Luck Prime 2060937 digits.
Have a look at my  Web Cam of Parliament House Ottawa, CANADA

jave808

Quote from: Dingo on July 14, 2021, 06:05:14 PM
I do not use commands in Windows just BoincTasks that does all that on one or many computers.

If you want scripts to stop and start BOINC on Linux or Raspberry Pi I can help you out.

Yes please Dingo. I'm running Linux Mint 20.2 (based on Ubuntu).
PC1: Intel Xeon E5-2697v3, 64GB DDR4 ECC, Quadro M5000 & M4000, Linux Mint 22.3 Cinnamon
PC2: AMD Ryzen 7 5825U, 32GB DDR4, Radeon Graphics, Win11 Pro 26H2
PC3: AMD Ryzen 7 6800H, 32GB DDR5, Radeon Vega Mobile Graphics, Ubuntu 26.04.1 Cinnamon

Dingo

#3
There is a script for starting and stopping BOINC in the directory BOINC is loaded into.  On Ubuntu it is /usr/bin and the script is called boinc-client   I do not use that one I created a simple script to start and stop BOINC and allow remote gui.  This script is put into the /etc/init.d folder.

get to a root prompt by either logging in as root or using sudo -i

nano /etc/init.d/boinc

insert the following into the file and change the location of boinc if needed


# BOINC start/stop
#
if [ $1 == start ];then
cd /usr/bin
./boinc --daemon --allow_remote_gui_rpc
echo "Starting BOINC"
fi
if [ $1 == stop ];then
   pkill boinc
echo "Stopping BOINC"
fi


Make the file executable 

chmod 755 /etc/init.d/boinc

To stop and start BOINC the commands are.
/etc/init.d/boinc start
/etc/init.d/boinc stop

Update the system to recognise the script

update-rc.d boinc defaults

if you want to use your own password on BOINC, it makes it easier on BoincTasks etc.

nano /etc/boinc-client/gui_rpc_auth.cfg   ---->   insert the password
nano /usr/bin/gui_rpc_auth.cfg            ---->   insert the password

I have gone a bit further and made sure that BOINC starts at boot time or in the case of a reboot.

This time login as a user NOT ROOT and do the following exactly.

Quote
sudo crontab -e              // for info stored in /var/spool/cron/crontabs folder under root
   select #1  nano
           Add a line at the end of the file that reads like this:
         @reboot bash /home/user that was logged in that made the script/myscript.sh
         
  save and exit  Ctl+x  Y   enter

nano myscript.sh   ////  DO NOT USE SUDO****

add the following lines to the script.

#!/bin/bash
#
# Script to run at startup to start BOINC on Raspberry Pi4 / Ubuntu
#

/etc/init.d/boinc stop
/etc/init.d/boinc stop
/etc/init.d/boinc start
# -------------------------------------------

save the script then run

   sudo chmod a+x myscript.sh

 
Make another file

   sudo nano /etc/xdg/autostart/myapp.desktop

insert this line with no space in front of command or at the end.

Exec=lxterminal --command"/bin/bash -c 'sh myscript.sh; /bin/bash'" 

save and exit

That's it it should start BOINC on startup.

Give it a try with sudo reboot











Have a look at the BOINC@AUSTRALIA

Facebook Page and join and also the Twitter Page.

Proud Founder and member of BOINC@AUSTRALIA
My Luck Prime 2060937 digits.
Have a look at my  Web Cam of Parliament House Ottawa, CANADA

jave808

Thanks Dingo. A few questions....

1. Does the boinc script you create have to be in init.d?  Can I place it in /home/jave/bin which is in my path variable?

2. Not sure I need the 2nd part of your post to start boinc. It starts crunching away from power up/reboot as it is a service?

3. I remember either you or someone else telling me how to connect the running boinc tasks to boincmgr on bootup?  I have to manually connect it now via "New Boinc Manager window" and enter "localhost".  It was working fine before I screwed it up.
PC1: Intel Xeon E5-2697v3, 64GB DDR4 ECC, Quadro M5000 & M4000, Linux Mint 22.3 Cinnamon
PC2: AMD Ryzen 7 5825U, 32GB DDR4, Radeon Graphics, Win11 Pro 26H2
PC3: AMD Ryzen 7 6800H, 32GB DDR5, Radeon Vega Mobile Graphics, Ubuntu 26.04.1 Cinnamon

Dingo

#5
Quote from: jave808 on July 15, 2021, 07:27:36 PM
Thanks Dingo. A few questions....

1. Does the boinc script you create have to be in init.d?  Can I place it in /home/jave/bin which is in my path variable?

If your tasks start at boot then you do not need this script.  there is probably a script called boinc-client in /etc/init.d that is starting BOINC. If that script is there you should be able to run /etc/init.d/boinc-client start or /etc/init.d/boinc-client stop


root@dingo3:~# /etc/init.d/boinc-client stop
Stopping boinc-client (via systemctl): boinc-client.service.
root@dingo3:~# /etc/init.d/boinc-client start
Starting boinc-client (via systemctl): boinc-client.service.



Quote
2. Not sure I need the 2nd part of your post to start boinc. It starts crunching away from power up/reboot as it is a service?

Quote

3. I remember either you or someone else telling me how to connect the running boinc tasks to boincmgr on bootup?  I have to manually connect it now via "New Boinc Manager window" and enter "localhost".  It was working fine before I screwed it up.

I don't use boincmgr I use BoincTasks and you can control all your machines as I have Linux servers that do not have a GUI. That is also why I change the password from the large hexadecimal one that BOINC uses.


In the second script i said to insert into crontab the following

@reboot bash /home/pi/myscript.sh

it should be

@reboot bash /home/user that was logged in that made the script/myscript.sh








Have a look at the BOINC@AUSTRALIA

Facebook Page and join and also the Twitter Page.

Proud Founder and member of BOINC@AUSTRALIA
My Luck Prime 2060937 digits.
Have a look at my  Web Cam of Parliament House Ottawa, CANADA