because it needs to be run by system/root and not at user level to be automated since it requires sudo privileges. thats why i suggested looking into how to do just that, suggested some examples of using a service to run the script at boot. there is another way im pretty sure would work but i think it to be a bit hacky and thats including a execute command in an existing service that runs on the system level (im sure this is probably frowned upon by some and not the proper way of doing it and is why i didnt suggest it )
Here is an example of how I would start a script in Konsole with root privileges from a desktop file. You would need to substitute your terminal program for konsole and substitute your own path.
Exec=konsole -e sudo /home/htpc/.scripts/wifi-restart.sh &
This is an even better way to do the same thing. This will not open a terminal window at all. This will simply open a small pkexec password prompt for your sudo password. The commands will all execute in the background. For this method to work you must install a small terminal program named "tmux".
Exec=pkexec tmux -c /home/htpc/.scripts/wifi-restart.sh; sleep2 & exit
I do not feel like playing 150 questions with you anymore. Please attempt to find some answers for yourself. Your main issue is resolved. These are now issues you should be able to take care of yourself.
I am really sorry to bother you all (and would like to work on my pad and stop boring you) with this topic and I thank you really for your great help!
I have downloaded tmux from pamac and wrote this line in huion.desktop:
Exec=pkexec tmux -c /home/nameid/Documents/pilote_tablette_graphique/HuionKamvasGT220v2LinuxDriver/start-driver.sh; sleep2 & exit
That does not work, also after sleeping/awaking the computer.
Afterwards I have replaced this line in huion.desktop, by
Exec=xfce4-terminal -e sudo /home/nameid/Documents/pilote_tablette_graphique/HuionKamvasGT220v2LinuxDriver/start-driver.sh &
but it has not worked neither...
I am sorry. Thanks again.
You do know you must substitute your "user name" for "nameid" in any command I hope.
Yes, of course. I write "nameid" for anonymizing purposes.
Thanks for your answer.
I was just double checking because either of those 2 commands I gave work fine for me. I have no idea why you are having such difficulty.
If you actually formatted your code on the forum properly it would be a lot easier to see if you had any syntax errors.
Information on how to properly post hardware specs and logs:
Please format any terminal output with three backticks before and after, as shown in this picture:
Have you made the desktop file you created executable?
Apparently not but all the .desktop files are like the huion.desktop. Doing ls -l in /home/nameid/.config/autostart:
ls -l total 32 -rw-r--r-- 1 nameid nameid 29 24 oct. 15:35 blueman.desktop -rw-r--r-- 1 nameid nameid 277 19 déc. 18:28 huion.desktop -rw-r--r-- 1 nameid nameid 1223 1 juil. 16:15 manjaro-hello.desktop -rw-r--r-- 1 nameid nameid 3411 13 oct. 15:30 redshift-gtk.desktop -rw-r--r-- 1 nameid nameid 70 19 déc. 18:29 xfce4-clipman-plugin-autostart.desktop -rw-r--r-- 1 nameid nameid 29 4 juil. 22:27 xfce4-settings-helper-autostart.desktop -rw-r--r-- 1 nameid nameid 29 4 juil. 22:27 xfce4-tips-autostart.desktop -rw-r--r-- 1 nameid nameid 28 4 juil. 22:27 xfconf-migration-4.6.desktop
And redshift that I have installed is working after every boot for example (and manjaro hello for example).
Should I nevertheless make the huion.desktop executable?
Every desktop file needs to be executable as far as I know.
There must be a way to determine where exactly is not working. Since is a cascade from the desktop file that calls the start-driver.sh that then calls the kamvas.py ... from what point is not working?
We can't test as we don't have that setup ... Also the startup is a bit different in XFCE than KDE Plasma ... AFAIK.
All I know is my desktop files in ~/.config/autostart are executable. Does the desktop fie launch properly if you copy it to your desktop and launch it from there. It must be executable.
If I do
sudo ./start-driver.sh it now always works! So there is a problem between the desktop file and the start-driver.sh one.
A few ideas:
- Check to be run as a program, so you mark the checkbox as active in the Permissions tab
- Add the working directory
/home/nameid/Documents/pilote_tablette_graphique/HuionKamvasGT220v2LinuxDriverin the Launcher tab ... probably checkbox the two boxes too
that will work if run from its containing directory . if you opened a fresh term and ran that you would need its directory no? assume the same for anything not in the same directory thats trying to run something from outside
Copying huion.desktop into my desktop and making
./huion.desktop bash: ./huion.desktop: Permission non accordée
So I made it executable and still present on the desktop repository/directory and tried again:
[nameid@computerid Bureau]$ ./huion.desktop ./huion.desktop: ligne 1: [Desktop : commande introuvable ./huion.desktop: ligne 7: -e : commande introuvable
man xfce4-terminal, I can find:
-e, --command=command Execute command inside the terminal
So this command (i.e. xfce4-terminal -e) seems to exist but is reported to be problematic...
Should I try now to do
./huion.desktop in ~/.config/autostart?
Well I guess the xfce terminal does not support the execute parameter. I know the gnome terminal does, but I'm totally unfamiliar with xfce.
Killi - please don't get confused ... the *.sh file you run from terminal but the *.desktop file you run it like whatever application that you open from menu ... you click/double click on it
Oh, I never caught that part.
It works indeed from its containing directory. If I open a new terminal windows (then being in ~) and do
sudo ./start-driver.sh it does not work:
sudo: ./start-driver.sh : commande introuvable
thats because your trying to run it from a terminal that defaults to /home/user/ , my point was more towards you needing to execute the desktop file or terminal command with the correct FULL directory.
(if thats where it is actually located)
should be what the .desktop file executes when run.