Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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..

share|improve this question
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 Apr 21 '11 at 19:35

1 Answer 1

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.

share|improve this answer
    
tried, doesn't work. –  Shoaibi Apr 22 '11 at 5: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 6: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 9:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.