Hi All,
I wrote a script to run first thing at shutdown over on CentOS 5.3. I use it to shutdown headless virtual machines. Will this modified version work in Kubuntu?
The big thing I have to double check is in Red Hat, you must:
Or it won't shutdown. Is this the same in Kubuntu?
And, is "/bin/logger" used the same way?
-T
My Modified script:
I wrote a script to run first thing at shutdown over on CentOS 5.3. I use it to shutdown headless virtual machines. Will this modified version work in Kubuntu?
The big thing I have to double check is in Red Hat, you must:
Code:
lockfile=/var/lock/subsys/a-local-shutdown touch $lockfile
And, is "/bin/logger" used the same way?
-T
My Modified script:
Code:
#!/bin/sh
# /etc/init.d/a-local-shutdown
#
# Similar to rc.local only run at shutdown (rc0/1/6.d)
#
# lockfile: /var/lock/subsys/a-local-shutdown
#
# Note: Red Hat checks for a lock file for your script in
# /var/lock/subsys/<scriptname> or it won't run your
# K* scripts. You will find a "touch" command below under "start
# to take care of this
#
#
# list with rdX.d's with
# find /etc -iname \*a-local-shutdown\* -print or
# find /etc -iname \*a-local-shutdown\* -exec ls -al {} \;
#
#
#########################################################################
# >> Do not place any custom code until the comment bar says you can << #
#########################################################################
echo -n $"Starting local-shutdown: "; echo
# Make sure rc.local.shutdown link exists:
if [ ! -h /etc/rc.shutdown ]; then
ln -s /etc/init.d/a-local-shutdown /etc/rc.shutdown
fi
# Take care of start house keeping
if [ "$1" = "start" ]; then
lockfile=/var/lock/subsys/a-local-shutdown
touch $lockfile
/bin/logger -p user.notice -t a-local-shutdown " rc.shutdown touched $lockfile"
exit 0
fi
# Show links rcX.d/KXXa-local-shutdown etc.
if [ "$1" = "showlinks" ]; then
find /etc -iname \*a-local-shutdown\* -exec ls -al {} \;
ls -al /etc/rc.shutdown
exit 0
fi
# Make sure this script was called correctly
if [ "$1" != "stop" ]; then
echo $"Usage: $0 {start|stop|showlinks}"
exit 2
fi
# Make a note in /var/log/messages that this script has been called:
/bin/logger -p user.notice -t local-shutdown " rc.local.shutdown has been invoked"
###################################################
# >>>> Place your custom code below this line <<<<#
###################################################
exit 0

Comment