#!/bin/sh # Add cleanup to 'atboot' stuff, if it exists if [ -f ${BASE}/etc/rcS.d/S99atboot ] then # make sure the right stuff is prepended mv ${BASE}/etc/rcS.d/S99atboot ${BASE}/etc/rcS.d/S99atboot.$$ cat >> ${BASE}/etc/rcS.d/S99atboot <<-'EOT' #!/bin/sh echo "`date`: atboot started" >> /var/sadm/system/logs/atboot.log mount >> /var/sadm/system/logs/atboot.log REBOOT=NO EOT # put the original stuff on the end cat >> ${BASE}/etc/rcS.d/S99atboot ${BASE}/etc/rcS.d/S99atboot.$$ rm ${BASE}/etc/rcS.d/S99atboot.$$ # make sure atboot has the right mode chmod 700 ${BASE}/etc/rcS.d/S99atboot # Add some cleanup code to the end cat >> ${BASE}/etc/rcS.d/S99atboot <<-'EOT' #rm /etc/rcS.d/S99atboot || echo "could not remove atboot" mv /etc/rcS.d/S99atboot /etc/rcS.d/X99atboot || echo "could not remove atboot" echo "`date`: atboot finished" >> /var/sadm/system/logs/atboot.log echo "REBOOT=${REBOOT}" >> /var/sadm/system/logs/atboot.log if [ "${REBOOT}" = "YES" ] then echo "`date`: atboot rebooting" >> /var/sadm/system/logs/atboot.log echo "Rebooted by atboot..." sync reboot fi EOT # now reboot into single user for it all to run echo "Rebooting for atboot..." /usr/sbin/shutdown -iS -y -g0 fi