View previous topic :: View next topic |
Author |
Message |
rjhsynios n00b
Joined: 31 Mar 2010 Posts: 3
|
Posted: Wed Mar 31, 2010 11:20 am Post subject: Little script help please |
|
|
Hi,
I need a script so that on shutdown my encrypted file system will be umounted and call cryptsetup luksClose.
I guess the right place is in /etc/init.d/ and to use the stop() { } to place the commands and then to rc-update add the script, however how to do I specify the script to be run early in the shutdown sequence and is it possible for the script to check if the mount point is mounted before it executes the commands. Any help would be appreciated, I am not much of a scripter.
Thanks. |
|
Back to top |
|
|
ursusca Apprentice
Joined: 10 Sep 2008 Posts: 284 Location: Toronto ON, CANADA
|
Posted: Wed Mar 31, 2010 6:53 pm Post subject: |
|
|
Hello,
You may unmount and shut off the encrypted partition manually like this:
Code: | # umount crypted
# cryptsetup luksClose <encrypted_partition>
|
So my sugestion is to try this:
Code: | #! /bin/bash
# /etc/init.d/my_script
#
touch /var/lock/my_script
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting my_script"
echo "I will create the encrypted partition later"
;;
stop)
echo "Stopping my script"
umount crypted
cryptsetup luksClose <encrypted_partition>
;;
*)
echo "Usage: /etc/init.d/my_script {start|stop}"
exit 1
;;
esac
exit 0
|
_________________ You deserve free software! |
|
Back to top |
|
|
|