1

Ubuntu 18.04.3 gnome shell 3.28.4

I have a shell script that, when I manually run it, successfully does what I want it to do: It disables a specified gnome-shell extension. The script is simple, it is this:

nohup gnome-shell-extension-tool -d ExtensionName@extenstion.user.stuff

It works great, when the extension is enabled, if I run this script, the extension gets disabled.

I then created a custom systemd service to run that script at shutdown, here is what it looks like:

[Unit]
Description=disable ExtensionName on shutdown, reboot, etc.
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target

[Service]
Type=oneshot
ExecStart=/home/main1/DisableExtensionName.sh

[Install]
WantedBy=halt.target reboot.target shutdown.target

I saved that file in /etc/systemd/system, with owner of root:root, and permissions of 644.

Then, I thought I need to both enable that service, and then start it. So, I ran the command

sudo systemctl enable DisableExtensionName.service.

Then, I ran the command to start the service:

sudo systemctl start DisableExtensionName.service.

Then, to check things out, I ran this command:

sudo systemctl status DisableExtensionName.service

and got these errors in the output:

Loaded: loaded (/etc/systemd/system/DisableExtensionName.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-11-20 09:15:09 CST; 25s ago
  Process: 11008 ExecStart=/home/main1/DisableExtensionName.sh (code=exited, status=
 Main PID: 11008 (code=exited, status=1/FAILURE)

system1 systemd[1]: Starting disable ExtensionName on shutdown, reboot, etc....
Nov 20 09:15:09 system1 DisableExtensionName.sh[11008]: 'ExtensionName@extension.user.stuff' is not enabled or installed.
Nov 20 09:15:09 system1 systemd[1]: DisableExtensionName.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 09:15:09 system1 systemd[1]: DisableExtensionName.service: Failed with result 'exit-code'.
Nov 20 09:15:09 system1 systemd[1]: Failed to start disable ExtensionName on shutdown, reboot, etc..

I don't understand these errors. Especially, the error above that says this:

DisableExtensionName.sh[11008]: 'ExtensionName@extension.user.stuff' is not enabled or installed.

That is clearly in error, I know for sure that gnome-shell extension is both installed and enabled.

Of course, when I shut down my computer, this service does not work - I know it doesn't work because when I start the computer again, that gnome-shell extension is immediately enabled, instead of the computer starting with that gnome-shell extension being in a disabled state, which is what I want.

Why does the message tell me that the gnome-shell extension is not installed and enabled when in fact it is?

How do I change my shell script and/or my custom systemd file so that gnome-shell extension is disabled when I shutdown my computer (or log out of my user)?

Thank you for any help.

PRATAP
  • 22,460
dln949
  • 1,267
  • 5
  • 16
  • 31
  • https://askubuntu.com/editing-help will help you format your content here. – DK Bose Nov 20 '19 at 16:05
  • ExecStart=? why? dont it be ExecStop= ?? – PRATAP Nov 20 '19 at 16:14
  • @JusticeforMonica , thank you for the edit and the advice. I say this in a friendly and sincere manner: I looked at that page you recommended, but I have no idea what it is talking about. For example, right at the top it says, "Indent four spaces to create an escaped
      block:"  I have no idea what that means, nor when I should do that.  I cannot figure out from that page what you did to make my post look so much better.  I will need a much more simplified guide.
    
    – dln949 Nov 20 '19 at 16:15
  • @PRATAP , sorry, I don't know what you're trying to say. Can you reword that, be more specific? Sorry, I am no expert in this stuff, I'm just copying what I've seen elsewhere - Are you telling me that I need question mark characters after the equal sign when using ExecStart? – dln949 Nov 20 '19 at 16:18
  • in your code.. the lines [Service] for shutdown, the line should be ExecStop – PRATAP Nov 20 '19 at 16:20
  • have you followed this post? or not yet? https://askubuntu.com/a/796157/739431 – PRATAP Nov 20 '19 at 16:21
  • @dln949 I am sorry.. ExecStart must be the rite one. – PRATAP Nov 20 '19 at 16:25
  • @PRATAP , thanks for the guidance. Yes, that link is exactly what I was reading. It did not explain the difference between ExecStart and ExecStop. I assumed it referred to starting or stopping the script file. Now I think you're telling me it refers to starting or stopping the system. (I don't know about these things.) I'll go back and try ExecStop instead. – dln949 Nov 20 '19 at 16:26
  • @PRATAP , ok, I see your latest message. – dln949 Nov 20 '19 at 16:27

0 Answers0