Super confused between upstart and systemd
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.
It is likely a permissions issue. Both .conf
files need to be executable.
Do:
chmod a+x ~/.config/upstart/shutdown.conf
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
- https://askubuntu.com/a/613814/43344
- "Boot and service management". Upstart version 15 release notes. 2015-04-24. Ubuntu.
- "Session Init". upstart Cookbook. Ubuntu.
- James Hunt, Stéphane Graber, Dmitrijs Ledkovs, and Steve Langasek (2012-11-12). "Respawning user jobs and PID tracking". Ubuntu Raring upstart user sessions. Ubuntu.
- Nathan Willis (2013-04-17). Upstart for user sessions. LWN.
- Discuss how Session Inits (upstart) could be migrated to systemd 2014-03-11. Ubuntu summit.
- https://unix.stackexchange.com/a/194208/5132