LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-15-2013, 11:34 AM   #1
y-man
LQ Newbie
 
Registered: Sep 2013
Location: Canada
Distribution: Mint 13 Maya
Posts: 2

Rep: Reputation: 0
Added rc0.d script does not run


Hi,

I am running Mint Maya 13 Mate version.

I have added the following script as "/etc/init.d/shutdownFsck".

Code:
#! /bin/sh
# /etc/init.d/shutdownFsck

case "$1" in
  start)
    touch /root/sdf
    /usr/bin/python /usr/local/sbin/shutdownFsck.py
    ;;
  *)
    echo "Usage: /etc/init.d/shutdownFsck start"
    exit 1
    ;;
esac
I have sym-linked it to /etc/rc0.d as S38shutdownFsck, which will run it just before umountfs. Since my purpose is to fsck big partitions during shutdown, and leave root partition fsck as is (done during boot), and my shutdownFsck.py unmounts then checks the partition(s) of interest this order seemed aprropriate for me.

Both shutdownFsck and shutdownFsck.py has some output in the /root so I can see that they ran, and what they have done.

My problem is that normal shutdown from the Mint menu never runs my script.

I can run it with "sudo /etc/init.d/shutdownFsck start", and get the expected results correctly and completely.

I am stumped, and somewhat suspicious that there might be an interaction with upstart init system. However I saw no .conf file for umount or fsck under /etc/init.

Any ideas to get this to run will be much appreciated.

Thanks in advance.
 
Old 09-16-2013, 11:07 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Shutdown script symbolic links start with "K" not "S", that is your problem.

For maintainability purposes, I'd name the script with a ".sh" extension.
 
Old 09-17-2013, 01:20 PM   #3
y-man
LQ Newbie
 
Registered: Sep 2013
Location: Canada
Distribution: Mint 13 Maya
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks.

Actually the links in /etc/rc0.d are a mix of K and S type:
Code:
$ ls /etc/rc0.d
K01mdm                     README           S38shutdownFsck
K10unattended-upgrades     S20sendsigs      S40umountfs
K20hddtemp                 S30urandom       S60umountroot
K20speech-dispatcher       S31umountnfs.sh  S90halt
K20virtualbox-guest-utils  S35networking
However, your comment made me think that may be regardless of link name they are all called with "stop".
I have experimented, and found that to be the case. All K and S links are called with "stop", and in the order of their numerical name-parts.

My script is now called, and does its work.

Thanks again.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linking init script to specific rc0.d, rc1.d etc directories vinaytp Linux - Newbie 4 08-20-2010 03:01 AM
Running a script upon a file is added to a directory mohtasham1983 Linux - General 5 11-18-2008 10:25 PM
Scripts under rc0.d and rc6.d do not seem to run during shutdown.reboot oferu Linux - Newbie 4 03-26-2008 10:34 AM
Trying to run fsck from rc0 musther Linux - Kernel 8 09-20-2007 07:57 PM
Why won't my FC3 rc0 and rc6 levels not call kill script when entering those levels? dvkwiatk Linux - General 2 11-11-2006 08:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:02 AM.

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