You are not logged in.
Hi there,
I have a bash script that run a rsync command
when I run the script from terminal (gnome) it works fine:
sh ./rsync
Now I create a desktop entry (as I already done for many other scripts) but when I double-click it I got the error:
There was an error launching the application
The desktop entry:
[Desktop Entry]
Version=1.0
Name=Rsync
Comment=Rsync backup script
Exec=/opt/n00r/rsync/rsync
Icon=rsync
Terminal=true
Type=Application
Categories=0Scripts
The bash script :
#!/bin/sh
rsync -aR --relative --stats --protect-args --delete-after $(cat /home/n00r/Scripts/rsync/dirs_list) /run/media/n00r/Backup/arch-backup >> /home/n00r/Scripts/rsync/log.log
One more strange thing is the desktop entry don't appear in the menu. But if I change the exec command to open the file in sublime it works and the icon is shown in the menu
[Desktop Entry]
...
Exec=subl /opt/n00r/rsync/rsync
...
I think my desktop entry file is ok, the script is ok too but something goes wrong with executing a rsync command in bash from a desktop entry
Ps: the script is placed in opt folder as all my other script
I have spent all my day trying to fix it and now I'm giving up and hope someone cant help me
Thanks
Last edited by n00r (2020-05-30 21:12:48)
Offline
Why would you give the script the same name as the binary?
# edit: paste the output of `printf "%s\n" "$PATH"`
Last edited by jasonwryan (2020-05-30 20:54:01)
Offline
You say you run it as `sh ./rsync` but in the desktop file you try to execute the script directly. This would not be at all surprising if the script was not executable. Can you run the script directly from the command line?
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Why would you give the script the same name as the binary?
# edit: paste the output of `printf "%s\n" "$PATH"`
Thank you for the replay
excuse me by binary you mean the desktop file ?
the output of `printf "%s\n" "$PATH"`:
/home/n00r/home/n00r/dart-sass:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
Offline
So /opt/n00r/rsync/rsync isn't in your path, and the file is not executable...
Don't name your scripts after the binary they call, it can lead to collisions and abherrant behaviour.
Offline
You say you run it as `sh ./rsync` but in the desktop file you try to execute the script directly. This would not be at all surprising if the script was not executable. Can you run the script directly from the command line?
wow thank you Trilby, you are right the script wasn't executable that's why
so many hours lost for an idiot thing
Thank you again and to jasonwryan too
Offline