In the admin guide they say that we should place the script in /etc/init.d/ and enable it using update-rc.d but that didn't work so I tried to place this in /etc/init/cloudstack.conf
##########################################################################That didn't not work either, so I took a look at the script and figured it needed to have the network configured to run.
description "CloudStack password reset"
author "Luis Davim"
# Be sure to block the display managers until our job has completed. This
# is to make sure our kernel services are running before user
# may launch.
start on runlevel [235] or starting gdm or starting kdm or starting prefdm
stop on runlevel [06]
pre-start exec /etc/init.d/cloud-set-guest-password
post-stop exec /etc/init.d/cloud-set-guest-password
So I configured my network interface like this:
Note: I've also modified the password script to use chpasswd insted of passwd --stdin since ubuntu does not have the --stdin option in passwd and both ubuntu and centos have chpasswd but that was/is not the problem because usermod with mkpasswd was working...
just replaced:
# The primary network interfaceyou can also link the script into the /etc/network/if-up(down) folders:
auto eth0
iface eth0 inet dhcp
post-up /etc/init.d/cloud-set-guest-password
pre-down /etc/init.d/cloud-set-guest-password
ln -s /etc/init.d/cloud-set-guest-password/etc/network/if-up/cloud-set-guest-passwordAnd that was it, now I have an Ubuntu template with a working password reset script.
ln -s /etc/init.d/cloud-set-guest-password/etc/network/if-down/cloud-set-guest-password
Note: I've also modified the password script to use chpasswd insted of passwd --stdin since ubuntu does not have the --stdin option in passwd and both ubuntu and centos have chpasswd but that was/is not the problem because usermod with mkpasswd was working...
just replaced:
echo $password | passwd --stdin $userwith
echo "$user:$password" | chpasswd
If you give the script a proper LSB header, both the update-rc.d cloud-set-guest-password defaults and the network dependency work out of the box:
ReplyDelete### BEGIN INIT INFO
# Provides: cloud-set-guest-password
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Reset password
# Description: Set new password from DomR
### END INIT INFO