Run a command at boot

Hi guys,

To change the fan settings on my video card, I have to run this command:

aticonfig --pplib-cmd “set fanspeed 0 70”

The problem is that I have to enter this command every time I boot my machine.

Where can I put this line so it gets executed every time I boot?

Cheers.

There is /etc/boot.local.

It is executed very early in the boot process. It my be to early for what you wanr, but you can try.

It might be usefull to use the fulll path to aticonfig in your command. The PATH environment variable may not be set to anything usefull in that early stage. If you do not know, you can find the full path with

which aticonfig

(when there is no answer as a normal user do this as* root*).

I added the line:

/usr/bin/aticonfig --pplib-cmd “set fanspeed 0 70”

to /etc/init.d/boot.local

but it didn’t work :\

Does anyone know how I could do this?

I really need this because if I forget to change the fans when I boot, my card gets really hot. It’s a beast card.

Cheers.

well…you never said which desktop you run…but if you run KDE
then you can try this pretty clunky way (i’m not a real hacker…one
of them can tell you a much better way, i’m sure…and, maybe when
they get through laughing at mine, they will:)

  1. as yourself (not as root) with a text editor make a file that looks
    like this inside:

#!/bin/sh
# change fan settings on video card
# locate this file in /home/[you]/.kde4/Autostart/[some_name]

/usr/bin/aticonfig --pplib-cmd "set fanspeed 0 70"

  1. name it what you wish (maybe set_video_fan) and save it to

/home/[you]/.kde4/Autostart/set_video_fan

  1. make the file executable

the next time you log into KDE it should set your fan as you
wish…otoh, if someone else boots the machine and logs into a
different user account…it won’t…

see if that works for you


palladium

Thanks palladium;

I am using the Gnome desktop gui.

I will try this on the Gnome anyways, and report back.

Thanks!

Sorry to be an idiot, but how do I make it executable?

Do I just save it as set_video_fan.sh ?

Cheers.

edit: SOLVED

Thanks very much palladium. it is now working!

i did, chmod 755 to my script, to make it executable (i think)

added to my startup programs, presto!

Cheers!!

breakitdown wrote:
> I don’t know how to make it executable, I think this is the problem.

probably…in your file manager…i think the one for Gnome is still
named Nautilus (?)…go to wherever you put the file and right click
on it, select properties and look around for a check box (or
something) to mark it as executable…possibly in Gnome this box will
be on the Properties tab…

if just naming it with an .sh on the end would do the trick i would
have suggested that name…

i don’t know, but i guess you kinda new to openSUSE and if so you
should probably state that in your question post, that way folks know
to either explain “make the file executable” or point you to a URL
which explains…

if you come from windows you might know that it learns what to do with
a file by how it is named (that is .com .exe .bat and others are
executables and .doc is a Word document and etc)…that is not the
convention in Linux…that is to say that Linux is smart enough to
look inside the file to determine what it is, and will probably use
the right tool…however it will NOT execute any file until it is
marked such…

(try it, find an image file, say [something].jpg and just take the jpg
off and click on it…it will probably open in your default image
viewer application…or, offer you a list of several image viewers…


palladium

You did chmod on the file that contains the script. But you should be SURE about what it does.

And yes, it makes it executable for the owner (your userid), the group it belongs to and for all others (in fact thus for everybody). It also makes it readable to all three categories and it also makes itt writable to the owner alone.
You really should read:

man chmod

I say that as a general task for you. Wherever you find a hint to use a statement, check what it is going to do by reading its man page until your are sure your are not going to blow up your system by either
. using the statement in a case where the original writer did not mention it for;
. using the statement where the original writer does not even know what (s)he is advising, but still thinks (s)he is a guru;
. The writer is has a sadistical person who shows dangerous statements in the hope that some ignorant uses it.
And in the end it is you and only you that is responsable for the results of the statements you type.

Needless to say, all that palladium tells you is worthwhile to study.

Thanks for the advice.

As I understand it: the 7 is for read write and execute for the owner (me), the 5 is for read and execute for groups, and the other 5 is for read and execute for everyone else.

So to make it executable for just me, would it be 7-4-4?

Thanks again for all your help. I am new to using openSuse, but i’m trying hard to give it a fair go. I find it very interesting. Sometimes to do the most basic things; it takes me hours of research. I’m very grateful for having the opportunity to post here and get answers to my questions from you guys.

Cheers.

Whhen you do

chmod 755

or

chmod 744

you do not only set bits you also unset bits. (when there were any set).
When you only want to change the execution bit for the owner

chmod u+x

ia very good because it leaves all other bits untouched.
Please read

man chmod

hcvv wrote:
> And in the end it is you and only you that is responsable for the
> results of the statements you type.

maybe i’m paranoid

(probably i am, having been through this before while OS/2 was killed)

but,

if i worked for a company based in Redmond Washington and were
interested in SELLING an overpriced, high profit proprietary software
system all over earth which is frail and Malware Ready[tm], i would be
REAL busy just now secretly sowing seeds of discord and easy ways to
kill a Linux system (like with chmod, rm-rf, logging in as root, and
so many other easy traps to snag the n00b) in as many different
postings and how-to pages i could…

i am convinced it is happening…every day…


palladium
Windows7 is here and it is Malware Ready!

Henk is merely trying to show what implications commands followed can have. I’m probably paranoid as well, old-fashioned maybe, but I’ve seen too many 755’s and 644’s where there should have been 700’s and 600’s, with unwanted results.

Hi,

Not meaning any disrespect to those who are obviously more knowledgeable
than myself, I couldn’t help but notice the OP asked for a method of
executing a script at boot, and the solution was for executing a script
when the DE starts.

This may seem picky, however this could cause problems if the OP decides to
change DEs and forgets to add the script to all DEs being used.

Wouldn’t a crontab using @reboot be more appropriate?


Regards,
Barry Nichols

Barry Nichols wrote:
> I couldn’t help but notice the OP asked for a method of
> executing a script at boot, and the solution was for executing a script
> when the DE starts.

i agree…but, the non-DE hooked recipe given earlier (use
/etc/boot.local) didn’t work (and i freely admit i didn’t know a
better non-DE way) so i gave him a kludge that will work UNTIL someone
with a better way comes along…maybe that is you, so speak up!

> Wouldn’t a crontab using @reboot be more appropriate?

i’m not following, i don’t see where you are going with this…how
would you construct the non-DE hooked solution? (i’m in learn mode)


palladium

I did make a post to the praise of Barry_Nichols. But it seems that I did something wrong and it is not added to the thread.

We did not succeed with* boot.local* (to early I presume). But, as root, doing

crontab -e

and then add a line like

@reboot /usr/bin/aticonfig --pplib-cmd "set fanspeed 0 70"

has a better change.

palladium <palladium@no-mx.forums.opensuse.org> writes:

> Barry Nichols wrote:
>> I couldn’t help but notice the OP asked for a method of
>> executing a script at boot, and the solution was for executing a script
>> when the DE starts.
>
> i agree…but, the non-DE hooked recipe given earlier (use
> /etc/boot.local) didn’t work (and i freely admit i didn’t know a
> better non-DE way) so i gave him a kludge that will work UNTIL someone
> with a better way comes along…maybe that is you, so speak up!
>
>
>> Wouldn’t a crontab using @reboot be more appropriate?
>
> i’m not following, i don’t see where you are going with this…how
> would you construct the non-DE hooked solution? (i’m in learn mode)

Well, I thought the script you constructed could be called from the
root’s crontab using @reboot as the time specifier: which should run the
script once at startup; please correct me on this as I’ve never used it,
but read it in man crontab.


Regards,
Barry Nichols

> Well, I thought the script you constructed could be called from the
> root’s crontab using @reboot as the time specifier: which should run the
> script once at startup; please correct me on this as I’ve never used it,
> but read it in man crontab.

VERY good…thanks…
my wise mommy told me to learn something every day…
i can check that box today!


palladium

Whoa! I don’t understand a word of what you guys are saying. I’m very new to this.

So the way I did it was wrong?

If so what is the correct way. Please disregard if I misunderstood.

By the way the script worked, i’m so happy. I can finally relax while using my linux.