x404.co.uk
http://www.x404.co.uk/forum/

Run program on startup
http://www.x404.co.uk/forum/viewtopic.php?f=4&t=8661
Page 1 of 1

Author:  saspro [ Fri Jun 04, 2010 8:31 am ]
Post subject:  Run program on startup

Hi guys probably an easy one for you.

I've got 2 ubuntu 9.04 folding rigs running the fah bigadv client.
To start this I do the following:
open terminal
cd folding
./fah6 -smp 8 -bigadv -verbosity 9

Is there a way to script that to run when the machine boots?

Author:  big_D [ Fri Jun 04, 2010 9:10 am ]
Post subject:  Re: Run program on startup

Put them in a shell script and put the script file in /etc/init.d (remember to set the executable flag). It will then automatically start when the machine boots up.

Author:  saspro [ Fri Jun 04, 2010 6:42 pm ]
Post subject:  Re: Run program on startup

big_D wrote:
Put them in a shell script and put the script file in /etc/init.d (remember to set the executable flag). It will then automatically start when the machine boots up.


Do what now?

Author:  forquare1 [ Fri Jun 04, 2010 6:58 pm ]
Post subject:  Re: Run program on startup

saspro wrote:
big_D wrote:
Put them in a shell script and put the script file in /etc/init.d (remember to set the executable flag). It will then automatically start when the machine boots up.


Do what now?


Something like this:

Code:
sudo echo "#!/bin/sh" >> /tmp/folding
sudo echo "/absolute/path/to/folding/fah6 -smp 8 -bigadv -verbosity 9" >> /tmp/folding
sudo mv /tmp/folding /etc/init.d/folding
sudo chmod 550 /etc/init.d/folding
sudo ln -s /etc/init.d/folding /etc/rc2.d/S99folding


I think

EDIT: However, I can't get this to work on the latest Ubuntu...

Author:  koli [ Fri Jun 04, 2010 7:41 pm ]
Post subject:  Re: Run program on startup

saspro wrote:
big_D wrote:
Put them in a shell script and put the script file in /etc/init.d (remember to set the executable flag). It will then automatically start when the machine boots up.


Do what now?

Awesome :lol:
I am with you on this one. I was told to use "back-ticks" so I had to google what back-ticks were :oops:
Linux eh...

Author:  rustybucket [ Sat Jun 05, 2010 9:40 am ]
Post subject:  Re: Run program on startup

Try opening the system monitor app and creating a new start-up entry. It works for me but that's under KDE4

Author:  Linux_User [ Sat Jun 05, 2010 7:23 pm ]
Post subject:  Re: Run program on startup

Quote:
How to start the linux client as a service

Note: Adding the client as a service in Linux depends on which distribution you are using. The instructions below should work for the majority of distributions available in the market. If nothing works, you might need to do some research to find out what your distribution needs to install as a service.
Do not change accounts or change directory location then create a script named folding by pasting the following commands:
echo "# chkconfig: 345 93 14" > ./folding
echo "# description: will start FAH client as a service" >> ./folding
echo "su - $USER -c \"cd $PWD; ./fah6 -verbosity 9 < /dev/null >
/dev/null 2>&1 &\"" >> ./folding
chmod +x ./folding
Note: In the following steps, replace [fahdir] with the value you saw on screen during the previous installation steps (don't include the brackets).
To mark down where you installed the FAH client just run:
echo "[fahdir] = $PWD"
Note: All the following steps need root privileges to be carried out successfully.
For Debian-based distributions run:
sudo cp [fahdir]/folding /etc/init.d/
For other distributions run:
su - -c "cp [fahdir]/folding /etc/init.d/"
Note: If you installed the client under root user account, do this instead :
echo "# chkconfig: 345 93 14" > ./folding
echo "# description: will start FAH client as a service" >> ./folding
echo "cd $PWD; ./fah6 -verbosity 9 < /dev/null > /dev/null 2>&1 &" >>
/etc/init.d/folding
chmod +x /etc/init.d/folding
Last step is to register the folding service.
For Debian-based distributions run:
sudo update-rc.d folding defaults
For other distributions run:
su - -c "chkconfig --add folding"
That's all so reboot the computer to make the new script start the client. To check if it is working fine, just go to your folding folder and open fahlog.txt or run:
tail -f [fahdir]/FAHlog.txt


http://folding.stanford.edu/English/LinUNIGuide

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/