News:

Members can see all forum boards and posts. Non members can only see a few boards.  If you have forgotten your password use this link to change it.
https://forum.boinc-australia.net/index.php?action=reminder

Main Menu

How to start BOINC from command line

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

Previous topic - Next topic

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: AMD Ryzen 9 5950X @3.4GHz, 128GB DDR4, 2 x RTX3070, Linux Mint 22 Cinnamon
PC2: AMD Threadripper 1950X @3.4GHz, 64GB DDR4, Titan X, Ubuntu 24.04
PC3: Intel i7-3770, 16GB DDR3, GTX1050, Linux Mint 22 Cinnamon (Semi-retired)

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.


Radioactive@home graph
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 1,056,356 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: AMD Ryzen 9 5950X @3.4GHz, 128GB DDR4, 2 x RTX3070, Linux Mint 22 Cinnamon
PC2: AMD Threadripper 1950X @3.4GHz, 64GB DDR4, Titan X, Ubuntu 24.04
PC3: Intel i7-3770, 16GB DDR3, GTX1050, Linux Mint 22 Cinnamon (Semi-retired)

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






Radioactive@home graph
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 1,056,356 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: AMD Ryzen 9 5950X @3.4GHz, 128GB DDR4, 2 x RTX3070, Linux Mint 22 Cinnamon
PC2: AMD Threadripper 1950X @3.4GHz, 64GB DDR4, Titan X, Ubuntu 24.04
PC3: Intel i7-3770, 16GB DDR3, GTX1050, Linux Mint 22 Cinnamon (Semi-retired)

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



Radioactive@home graph
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 1,056,356 digits.
Have a look at my  Web Cam of Parliament House Ottawa, CANADA