1

Given I'm running 15.10 my system should be using systemd confirmed by...

$ ps -p1 | grep systemd && echo systemd || echo upstart
    1 ?        00:00:02 systemd
systemd

But I have an upstart script defined, ~/.config/upstart/startup.conf

description "my startup scripts"
start on desktop-start

task
console log
script
  exec ~/scripts/startup.sh start
end script

The startup script works I guess using upstart?

But then I have a shutdown script also defined, ~/.config/upstart/shutdown.conf

description "my shutdown scripts"
start on desktop-end

task
console log
script
  exec ~/scripts/backup.sh start
end script

But that script does not start. And when I try to start either manually..

sudo start startup or sudo start shutdown I get..

start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

The shutdown script works if I run it manually from ~/scripts/backup.sh.

Permissions

-rwxrwxr-x 1 deanresin deanresin    933 May 28 01:31 backup.sh
-rwxrwxr-x 1 deanresin deanresin   2061 May 28 14:06 startup.sh
-rw-rw-r-- 1 deanresin deanresin 124 May 28 14:04 shutdown.conf
-rw-rw-r-- 1 deanresin deanresin 218 May 28 14:02 startup.conf

thanks to commenter below it was a permission issue. Changed to..

-rwxrwxr-x 1 deanresin deanresin 124 May 28 14:04 shutdown.conf
-rwxrwxr-x 1 deanresin deanresin 218 May 28 14:02 startup.conf

Edit: for some reason startup.conf doesn't require execution permissions. These permissions were working...

-rwxrwx--- 1 deanresin deanresin 124 May 28 14:04 shutdown.conf
-rw-rw---- 1 deanresin deanresin 218 May 28 14:02 startup.conf

Why is my startup script working and why isn't my shutdown script working? And why is upstart working? Or is it? I'm super confused.

Zanna
  • 72,312

2 Answers2

2

It is likely a permissions issue. Both .conf files need to be executable.

Do:

chmod a+x ~/.config/upstart/shutdown.conf
2

And why is upstart working? Or is it? […] I'm still confused why upstart is working at all.

systemd is running as the system-wide service manager. upstart is running as a per-session service manager.

Further reading

JdeBP
  • 3,979