You are not logged in.
Hi, I want to run a command during every startx.
Where do I need to place this command? I can't use it in ~/.xinitrc, because I need to be root for that, I can't put it in /etc/X11/xinitrc, beacuse it is overwriten by the ~/.xinitrc file.
Thanks
By the way, the issue is that my notebook freezed when I closed the lid. The remedy I foud is to run
# echo 1 > /proc/acpi/video/C098/DOS.
But this file doesn't exist at the time when /etc/profile is ran.
Offline
What about using sudo for an entry in ~/.xinitrc?
Offline
If you set up that command not to need a password, this should work.
Offline
By the way, the issue is that my notebook freezed when I closed the lid. The remedy I foud is to run
# echo 1 > /proc/acpi/video/C098/DOS.
add this command to /etc/rc.local and it will be run by root at every boot. much better IMHO.
//github/
Offline
actually, when I try to run this command with sudo
coub ~ $ sudo echo 1 > /proc/acpi/video/C098/DOS
bash: /proc/acpi/video/C098/DOS: Permission denied
this happens.
It works just as a root.
Don't know why,
cat /etc/sudoers
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow people in group wheel to run all commands
%wheel ALL=(ALL) ALL
And I am in the wheel group.
Offline
coubeatczech wrote:By the way, the issue is that my notebook freezed when I closed the lid. The remedy I foud is to run
# echo 1 > /proc/acpi/video/C098/DOS.add this command to /etc/rc.local and it will be run by root at every boot. much better IMHO.
I found out that the file /proc/acpi/video/C098/DOS doesn't exist at time there is no X server ran, so I think putting it in /etc/rc.local wouldn't solve that.
Offline
Create a daemon script under /etc/rc.d/ and call it from ~/.xinitrc ?
Offline
Create a shell script in /usr/sbin and call it from ~/.xprofile.
Offline
actually, when I try to run this command with sudo
coub ~ $ sudo echo 1 > /proc/acpi/video/C098/DOS bash: /proc/acpi/video/C098/DOS: Permission denied
this happens.
It works just as a root.
Don't know why,
That's because the shell interprets that as
(sudo echo 1) > /proc/acpi/video/C098/DOS
I.e. runs "sudo echo 1" and then tries to output that to a file it doesn't have write access to.
Try
sudo sh -c "echo 1 > /proc/acpi/video/C098/DOS"
instead. Also see EXAMPLES in man sudo.
Offline
coubeatczech wrote:actually, when I try to run this command with sudo
coub ~ $ sudo echo 1 > /proc/acpi/video/C098/DOS bash: /proc/acpi/video/C098/DOS: Permission denied
this happens.
It works just as a root.
Don't know why,That's because the shell interprets that as
(sudo echo 1) > /proc/acpi/video/C098/DOS
I.e. runs "sudo echo 1" and then tries to output that to a file it doesn't have write access to.
Try
sudo sh -c "echo 1 > /proc/acpi/video/C098/DOS"
instead. Also see EXAMPLES in man sudo.
Thanks for explanation, it works now.
Offline