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.

5
  • You mentioned ~/.config/upstart/startup.conf for the startup script but ~/.config/shutdown.conf (no upstart/ in the path) for shutdown. Is that a typo? May 28, 2016 at 18:35
  • 1
    Ok. Please update the question by posting the exact permissions of those two .conf files and of the two .sh files. May 28, 2016 at 18:40
  • I will shortly but I double checked the permissions already.
    – deanresin
    May 28, 2016 at 21:05
  • Yeah it turned out to be a permission issue as you suspected. I had to make the shutdown.conf executable. Oddly the startup.conf wasn't but still worked or I did something I don't remember. I'm still confused why upstart is working at all. I like it though.. it is more intuitive than systemd from initial ignorant impressions.
    – deanresin
    May 28, 2016 at 22:07
  • I guess I should turn that into an answer then. If you instead want to answer yourself, do not update the question. Write a self-answer. May 29, 2016 at 12:57

2 Answers 2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .