Reply to topic  [ 7 posts ] 
Run program on startup 
Author Message
Site Admin
User avatar

Joined: Thu Apr 23, 2009 5:53 pm
Posts: 8603
Location: location, location
Reply with quote
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?

_________________
Support X404, use our Amazon link
Get your X404 tat here
jonlumb wrote:
I've only ever done it with a chicken so far, but if required I wouldn't have any problems doing it with other animals at all.


Fri Jun 04, 2010 8:31 am
Profile WWW
What's a life?
User avatar

Joined: Thu Apr 23, 2009 8:25 pm
Posts: 10691
Location: Bramsche
Reply with quote
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 you know what this is? Hmm? No, I can see you do not. You have that vacant look in your eyes, which says hold my head to your ear, you will hear the sea!" - Londo Molari

Executive Producer No Agenda Show 246


Fri Jun 04, 2010 9:10 am
Profile ICQ
Site Admin
User avatar

Joined: Thu Apr 23, 2009 5:53 pm
Posts: 8603
Location: location, location
Reply with quote
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?

_________________
Support X404, use our Amazon link
Get your X404 tat here
jonlumb wrote:
I've only ever done it with a chicken so far, but if required I wouldn't have any problems doing it with other animals at all.


Fri Jun 04, 2010 6:42 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
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...


Fri Jun 04, 2010 6:58 pm
Profile WWW
Doesn't have much of a life
User avatar

Joined: Fri Apr 24, 2009 5:12 pm
Posts: 1171
Reply with quote
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...

_________________
Image
Free Sim with £5 credit


Fri Jun 04, 2010 7:41 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Jun 18, 2009 5:10 pm
Posts: 5836
Reply with quote
Try opening the system monitor app and creating a new start-up entry. It works for me but that's under KDE4

_________________
Jim

Image


Sat Jun 05, 2010 9:40 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Tue May 05, 2009 3:29 pm
Posts: 7173
Reply with quote
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

_________________
timark_uk wrote:
That's your problem. You need Linux. That'll fix all your problems.
Mark


Sat Jun 05, 2010 7:23 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.