Creating a shellscript of a few commands to execute on boot

Okay, I’ve added a page to the wiki about how to to enable Advanced Power Management on harddisks that support it, which can be found on Power saving by enabling hard disk AdvancedPM mode HOW TO - openSUSE

Now the question is, how to make a shell script out of the commands you’ll end up with at the end? The settings are forgotten by the disk once powered off so it would be nice to have a shellscript in the /.kde4/autostart/ folder to execute the command.

The three commands I end up with in my case are

hdparm -B 1 -S 24 /dev/sdb
hdparm -B 1 -S 24 /dev/sdb
hdparm -B 1 -S 24 /dev/sdb

But someone else might have different ones so if it’s possible to just have some template where to paste those those lines in… would be good to know.

The template is in /etc/init.d/skeleton. Copy it to a fiile with a name usefull for what you are doing. Read the documentation inside. In your case I think you only need statements in the start) part. Define the runlevel in the INIT INFO part. Now you can switch it on/off with YaST > System > System Services (Runlevel).

Normally you would also create a config file in /etc/sysconfig that can
source the variables you wish to provide… :slight_smile:

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 11.1 x86 Kernel
up 10:18, 2 users, load average: 0.01, 0.02, 0.05
GPU GeForce 6600 TE/6200 TE - Driver Version: 180.22

That is a very sensible idea of malcolmlewis. Maybe it is possible now to build a nice start/stop script that gets all of its info from the config file and publish that script in the WIKI, to be copied by an implementor. All that must be done by the implementor is building the configuration file.

Nice programming workout for Axeia :wink:

BTW Axeia, I read your WIKI, very interresting and well written (IMHO).
I made two changes.
One was a typo: a ’ to much in your /dev/sd* list.
The other is that I prefer very much **su - **over su. It sets the complete environment of root. When root runs in the environment of ‘some’ user a wretched PATH (on purpose or not) can create havoc. >:(

And as an afterthought I was amazed by the dir -l /dev/sd*. That is sooo MS-DOS! The *NIX command is **ls.**lol!

That’s why I get for having attended a “Microsoft certified academy” :wink:

Basically the only thing I can do without making any mistakes in the shell as well :stuck_out_tongue:
cd, dir, mkdir, cp