0

I have a simple script to help me do some power saving:

#!/bin/bash
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

I want this to run on every boot as root, tried running it by adding:

/bin/bash /root/power-save.sh

in

/etc/rc.local

and also tried by adding following to root's crontab:

@reboot /bin/bash /root/power-save.sh

no use..

Shoaibi
  • 809
  • 1
  • 10
  • 28
  • 1
    Either method (`/etc/rc.local` or `@reboot`) should work. There should be something from cron in `/var/log/syslog`, and cron will send you a mail if the command produces any output such as an error message. Add `set -x` at the top of the script (just after the `#!` line) and try again. Check that the script works when you invoke it directly, of course. – Gilles 'SO- stop being evil' Apr 21 '11 at 19:35

1 Answers1

2

You can run the commands directly in rc.local instead of running a script. Just put

echo 1 > /sys/module/snd_hda_intel/parameters/power_save
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

in rc.local.

duenni
  • 2,959
  • 1
  • 23
  • 38
  • tried, doesn't work. – Shoaibi Apr 22 '11 at 05:03
  • This is weird, does it work when you issue the commands directly? How do you verify that the commands don't work? – duenni Apr 22 '11 at 10:18
  • i `cat` the files and they don't contain the text there should be. Manually running them works though. – Shoaibi Apr 25 '11 at 06:40
  • Could you post the content of your rc.local? Also you could test if rc.local is executed at all put `echo $(date) >> /var/test.run` in it and check `/var/test.run` after reboot. Maybe the commands are not executed because there is something missing/not loaded when rc.local is running. You could try and put a `sleep 10` at the beginning of the file... – duenni Apr 25 '11 at 09:10