As part of a system-provisioning process for Ubuntu 14.04, I would like to prevent user logins until my script has completed. I have an upstart job with the following contents:
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
script
#launch the bash script that does install
/bin/bash /path/to/provisioning-script.sh
end script
This script runs at startup, but it does not prevent users from logging in. I have also tried the start directive
start on starting lightdm
But:
- it doesn't prevent logins
- applies only to systems using lightdm. Some of our systems boot to command line only
I have achieved the results I want in ubuntu 16.04 (systemd) with the following code:
[Unit]
DefaultDependencies=no
After=network.target
Before=systemd-user-sessions.service
[Service]
Type=oneshot
ExecStart=/bin/bash /path/to/provisioning-script.sh
StandardOutput=journal+console
StandardError=journal+console
[Install]
RequiredBy=systemd-user-sessions.service
Thanks!