Script not executed if started from the main menu

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Pommfriz

Script not executed if started from the main menu

Post by Pommfriz »

I wrote a script to allow a user to start a server and mount the cifs-share after a boot delay.
I altered the sudoers file to give the user acces to the mount command without entering the sudo-password.
All works fine if I execute the script within the terminal or the file explorer.
So I created a link to this script in the main menu.
But executing this link doesn't work. What could be the reason ?

My konfiguration:
mint 14 Nadia with Mate desktop.

The content of my script:
#!/bin/bash
# Server on
wakeonlan 00:23:05:EF:33:00
# Bootdelay
sleep 60
# Mount CIFS-share
sudo mount //192.168.1.250/Datensicherung /mnt/_freenas -o user=guest,guest

The additional sudoers entry:
%user ALL= NOPASSWD: /bin/mount


Regards
Pommfriz
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18228
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Script not executed if started from the main menu

Post by karlchen »

Hello, Pommfriz.

Assuming that the script is named "cifsmounter" and that it is located under /usr/bin, modify the menu launcher to launch the script like this:

Code: Select all

/usr/bin/cifsmounter > $HOME/cifsmounter.log 2>&1
Launch the script from the menu and find its screen output, error messages included, in the file $HOME/cifsmounter.log

Post the logfile content in case you need help interpreting it.

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
Pommfriz

Re: Script not executed if started from the main menu

Post by Pommfriz »

Thank you for your quick reply.
I tried to redirect the output to the log.
But the command was not executed.
It seems not to be a problem of my script.
I guess, it relates to the rights management, but I have no idea.

Kind regards
Pommfriz
User avatar
karlchen
Level 23
Level 23
Posts: 18228
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Script not executed if started from the main menu

Post by karlchen »

Hello, Pommfriz.

Have you checked whether a file named cifsmounter.log has been created in your home folder?
I gues you have made sure that the script has got the executable bit set? - You must have, because you wrote that you could launch it successfully inside a terminal window.

You state that you launch the script from the menu.
What is the name of the corresponding desktop file?
Where is it located?
What is the its content?

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
Pommfriz

Re: Script not executed if started from the main menu

Post by Pommfriz »

It seems to be a bug of mozo.
If I put the same starter located in mozo on the desktop then all works fine.

Regards
Pommfriz
User avatar
karlchen
Level 23
Level 23
Posts: 18228
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Script not executed if started from the main menu

Post by karlchen »

Hello, Pommfriz.

I see. No "mozo" here, because I use Cinnamon, not Mate. Cinnamon comes with the Cinnamon Menu Editor which looks a lot like good old "alacarte". But I would not bet that the current "alacarte" which can be used on Mate. So knowing there is "alacarte" may not help you solve your problem.

Cheers,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
Locked

Return to “Software & Applications”