Hi lovelypp
If you call:
exitcheck.sh reboot
then /opt/shutdown.sh will get called right before the system reboots.
If you call:
exitcheck.sh poweroff
then /opt/shutdown.sh will get called right before the system powers off.
When using a GUI, the Exit icon and the Exit from the desktop menu call exitcheck.sh the same way.
If you want /opt/shutdown.sh to know it was called to reboot or poweroff , add this to /opt/shutdown.sh:
ACTION="$(busybox ps | grep "exitcheck.sh")"
case "$ACTION" in
*"reboot"*)
# Commands to execute right before
# you reboot go here.
;;
*"poweroff"*)
# Commands to execute right before
# you power off go here.
;;
*)
# What to do if exitcheck.sh gets called
# with no or incorrect value goes here.
;;
esac
If you want to run something after you reboot, add this line to the reboot section:
touch /etc/sysconfig/tcedir/REBOOT
Then add the following to /opt/bootsync.sh or /opt/bootlocal.sh:
if [ -e /etc/sysconfig/tcedir/REBOOT ]
then
rm -f /etc/sysconfig/tcedir/REBOOT
# Commands to execute after
# you reboot go here.
fi