LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-01-2012, 08:20 AM   #1
firebirdsql
LQ Newbie
 
Registered: Dec 2011
Posts: 9

Rep: Reputation: Disabled
Shutdown script not running


I have a shutdown script that suspends all vmware workstation guests when the host is shutdown.

I manually placed symbolic links to the shutdown script in rc0.d (shutdown) and rc6.d (reboot). (ln -s /etc/init.d/shutdownvms /etc/rc0.d/K00shutdownvms)

The /etc/init.d/shutdownvms script is:
Code:
#! /bin/sh
vms=$(vmrun list | grep '/');
echo $(date) >> /home/log
echo 'total vms:'  ${vms}  >> /home/log
for vm in ${vms}
do
        echo 'suspending vm ' $vm >> /home/log
        vmrun suspend $vm soft
        echo 'done, sleeping 10 seconds' >> /home/log
        sleep 10
done
exit 0

The problem is, my script runs but it shows that there are 0 vms running.

In my rc0.d, I see that there is K01gdm which kills xserver/gdm. I think if those are killed, the VMware guests are also killed. However my script should be firing before that because it has a order of 0.

Maybe when gnome shutdown is trigger, it kills xserver etc.

How do I resolve this?
 
Old 01-02-2012, 07:54 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
Lightbulb

The scripts are run by naming conventions . K01 before K02 and so on. So you need to ensure your script runs prior to the script that kills the users.


http://www.yolinux.com/TUTORIALS/Lin...itProcess.html

Hope this helps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fighting with making running a script at startup only but not at shutdown/reboot ... Xeratul Debian 5 12-01-2010 01:13 PM
Script to close running apps before shutdown. Unknown_Entity Linux - Desktop 4 08-16-2009 05:41 PM
Shutdown script for Crunchbang Linux running from USB on Asus Surf 2G Maestro01 Linux - Laptop and Netbook 5 03-19-2009 11:11 AM
Script i created isn't running on Shutdown WHY aaarrghh?? helptonewbie Linux - General 18 01-07-2008 04:46 PM
Automatically running script at shutdown samac Slackware 2 05-14-2005 10:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration