Gustin Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ralf Mardorf wrote:
>   
>> Hi :)
>>
>> in a script I want to set a value by "echo 1024 >
>> /proc/sys/dev/hpet/max-user-freq".
>> This is fine when I manually run "sudo -i", followed by writing the
>> value, but not if I try to do it in one line, resp. in a script.
>>
>> spinymouse-s...@64studio:~/Desktop$ cat /proc/sys/dev/hpet/max-user-freq
>> 64
>> spinymouse-s...@64studio:~/Desktop$ sudo echo 1024 >
>> /proc/sys/dev/hpet/max-user-freq
>> bash: /proc/sys/dev/hpet/max-user-freq: Permission denied
>> spinymouse-s...@64studio:~/Desktop$ sudo -i echo 1024 >
>> /proc/sys/dev/hpet/max-user-freq
>> bash: /proc/sys/dev/hpet/max-user-freq: Permission denied
>> spinymouse-s...@64studio:~/Desktop$ sudo -i
>> r...@64studio:~# echo 1024 > /proc/sys/dev/hpet/max-user-freq
>> r...@64studio:~# logout
>> spinymouse-s...@64studio:~/Desktop$ cat /proc/sys/dev/hpet/max-user-freq
>> 1024
>>
>> Any hints are welcome!
>>
>>     
> Put the script in root's crontab.

It's not the complete script. It should become a script to restore an 
audio session, resp. there might be different scripts and I want to be 
able to launch them quickly from the terminal. A cronjob isn't wanted.

> sudo is designed as an interactive
> utility.  The script should be run by a user with sufficient privileges
> to do what it needs to do.  You can use sudo to run the script, but it
> should not be within the script.
>   

Those are fine in the script:

sudo chgrp audio /dev/hpet
sudo modprobe snd-hrtimer

Just this isn't fine:

sudo echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq

:(

If I should run the script with sudo, than this ...

jackd -Rch -dalsa -dhw:0 -r96000 -p512 -n2 -Xseq &
qtractor

... etc. must become ...

su username jackd -Rch -dalsa -dhw:0 -r96000 -p512 -n2 -Xseq &
su username qtractor
etc. unfortunately using the UID instead of the username doesn't work. Any way 
I won't run the script with sudo.

Hm, if there's no way to run
echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq
in this script, I should separate the HR timer stuff from restoring the session 
or I should install a root account to 64 Studio version Ubuntu.

su -c "echo $hpet_max_user_freq >/proc/sys/dev/hpet/max-user-freq"
should be fine, when having a root account.

Isn't it fine because the group isn't allowed to write?

spinymouse-s...@64studio:~$ ls -l /dev/hpet
crw-rw---- 1 root audio 10, 228 2009-12-26 00:55 /dev/hpet
spinymouse-s...@64studio:~$ ls -l /proc/sys/dev/hpet/max-user-freq
-rw-r--r-- 1 root root 0 2009-12-26 01:46 /proc/sys/dev/hpet/max-user-freq

Another issue is the frequency scaling. Normally it's "ondemand", but when 
restoring a session it should become "performance".

On Suse I'v got this for the terminal:

alias cpu-o="su -c\"cpufreq-set -gondemand\""
alias cpu-p="su -c\"cpufreq-set -gperformance\""

spinymouse-s...@64studio:~$ cpufreq-set --help
The program 'cpufreq-set' is currently not installed.  You can install it by 
typing:
sudo apt-get install cpufrequtils
bash: cpufreq-set: command not found

But, oops, okay, I see ...

spinymouse-s...@64studio:~$ cpufreq-selector --help
Usage:
  cpufreq-selector [OPTION...] - CPUFreq Selector

Help Options:
  -?, --help          Show help options

Application Options:
  -c, --cpu           CPU Number
  -g, --governor      Governor
  -f, --frequency     Frequency in KHz

spinymouse-s...@64studio:~$ sudo cpufreq-selector -g performance
spinymouse-s...@64studio:~$ sudo cpufreq-selector -g ondemand

... is fine for 64 Studio :).

_______________________________________________
64studio-users mailing list
[email protected]
http://lists.64studio.com/mailman/listinfo/64studio-users

Reply via email to