File: //opt/cloud-init/pre.sh
#!/bin/bash
readonly PROGNAME=$(basename $0)
readonly PROGDIR=$(readlink -m $(dirname $0))
readonly ARGS="$@"
is_file() {
local file=$1
[[ -f $file ]]
}
is_dir() {
local dir=$1
[[ -d $dir ]]
}
main() {
is_dir /usr/local/cpanel \
&& /scripts/restartsrv_cpsrvd --stop \
&& /scripts/restartsrv_chkservd --stop
is_file /usr/local/cpanel/cpanel.lisc \
&& rm -f /usr/local/cpanel/cpanel.lisc
is_file /etc/.whostmgrft \
&& rm -f /etc/.whostmgrft
echo "You should now shutdown this instance and template it up"
}
main