One specific Autostart Command in i3 config file not work

update

Related question is here.
My G913 interrupt the suspend of my pc.
solved by run a command in root.

Here is steps about how to make it:
stackoverflow


I get the command exec --no-startup-id echo disabled | sudo tee /sys/bus/usb/devices/1-10.1.4/power/wakeup
in my i3 config file. Which should turn the content of wakeup file from enabled to disabled.

But in fact it wont work.

in my config file I copy the file after the change like this:

exec --no-startup-id echo disabled | sudo tee /sys/bus/usb/devices/1-10.1.4/power/wakeup 
exec --no-startup-id cp /sys/bus/usb/devices/1-10.1.4/power/wakeup ~/wk.bak

The content of wk.bak is enabled.

The other exec command works fine. So why this happens.

Does it do that if you run it from command line?

I would expext sudo to be problematic in an autostart script.

1 Like

yeah it works from command line.
so how to start command with sudo?

What you probably mean is:
it works from command line after you did supply the admin password

I think this is the wrong question (https://xyproblem.info/).
A better one, if you want help, may be:
What is it that you want to achieve?

looks kike you want to wake up or put to sleep some USB device - toggle some energy saving function

addition:
if that is the case, perhaps this here can be inspiration

https://www.baeldung.com/linux/control-usb-power-supply

GitHub - ramzeto/usb-toggle: USB-Toggle is a Python script that allows to software unplug and software plug any USB device (including hubs).

2 Likes

You are asking the wrong question.

The right question is how do I run a script at system boot

You will need to execute the script as a systemd service and move the wk.bak file to another location e.g. /etc/wk.bak.

1 Like

thanks but seems the usb plug cant bypass the root. Finally will need the root auth to make it.

Thanks for your urls you post.

Ok, you said it’s solved.
Even though I think no one here knows what you even wanted to do. :man_shrugging:

sorry

Related question is here.
My G913 interrupt the suspend of my pc.

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.