You are not logged in.
Pages: 1
Topic closed
Hello all,
Could someone tell me what folder or what entries to be made if I want an event to take place before the machine actually start the reboot/shutdown process. For instants, i usually mount my USB flash drive but sometime I forget to umount it, which will cause a dirty file system when restarting the machine. Would anyone have an example to get me going. It's just like when rc.conf will do added things for you during start-up if special code/script was inserted.
There are other things I like to do before the machine reboot or shutdown, like, to run a very small scripts to automatically kill a certain process "first", before the rest and before rebooting. I'm sure I can write the code but I don't know where it goes.
Thanks in advance
PS: Thanks fsckd, Your explanation of SKIP/SEEK for dd has never been explained so well in any documentation, or on ANY web-site I ever been to in 6 months pass. Now I know how it really works and i'm getting it down to a science. I did not use it for what my thread indicate because in the end the other suggestions were better, but still I Thank God I finally know how to use SKIP/SEEK in dd. dd is my most use tool for what I do.
Offline
I think you want /etc/rc.local.shutdown . This runs right before the daemons are stopped.
Offline
umm ... you're welcome, sorry if I was a bit harsh ...
As for your question, see /etc/rc.local and its analogue /etc/rc.local.shutdown .
edit: hello ataraxia
Last edited by fsckd (2010-06-23 18:51:17)
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
I put my stuff in /etc/rc.shutdown as mentioned already. If you want something simple for your shutdown/reboot stuff I'd just use it as a function in your shell rc file. If you're worried about making sure it's unmounted, the script or function could include something like:
reboot() {
if [ -b /dev/disk/by-uuid/XXXXX ]; then
umount /dev/disk/by-uuid/XXXXX
fi
reboot
}
Same with poweroff or halt, whatever. Just an idea..
(typo)
Last edited by milomouse (2010-06-23 18:54:19)
Offline
Wow! I just added this and it works great ...
cd/ # to move out of the mounted directory if I was in it under another terminal.
Sleep 1 # give it room to think
ls # to see changed directory on screen
Sleep 1 # give it room to think
umount /b # do the main thing
Sleep 1 # give it room to think
There something new every day to learn with this OS. Just when you get one thing right here's comes another. I guest it took 20 years to build LINUX and I read the kernel has something like 10 - 30 million lines of code or better. Some how I lost the better link that went much deeper. 30 million lines of code mean billions of documentation to read. But you still got to find the right one first. So I guest we read and still have to ask questions just to get to the good parts, and than ...
http://en.wikipedia.org/wiki/Source_lines_of_code
Thanks again
Offline
Wow! I just added this and it works great ...
cd/ # to move out of the mounted directory if I was in it under another terminal.
Sleep 1 # give it room to think
ls # to see changed directory on screen
Sleep 1 # give it room to think
umount /b # do the main thing
Sleep 1 # give it room to thinkThere something new every day to learn with this OS. Just when you get one thing right here's comes another. I guest it took 20 years to build LINUX and I read the kernel has something like 10 - 30 million lines of code or better. Some how I lost the better link that went much deeper. 30 million lines of code mean billions of documentation to read. But you still got to find the right one first. So I guest we read and still have to ask questions just to get to the good parts, and than ...
http://en.wikipedia.org/wiki/Source_lines_of_code
Thanks again
Arch should already automatically unmount your USB drive. If it isn't unmounted, that's a bug and ought to be filed at http://bugs.archlinux.org
Offline
You can use Cron:
here is the link
-- SealsRock12
Offline
Please do not necrobump old threads, especially ones that aren't even using technology still included by default with arch. rc.local has been deprecated since systemd came around.
Offline
And
* cron is not event triggered while
* systemd has hooks in /usr/lib/systemd/system-shutdown/ and
* devices should™ be unmounted automatically anyway by now.
Offline
Please pay attention to the dates.
Don't necrobump: https://wiki.archlinux.org/index.php/Co … bumping.22
Closing.
Last edited by V1del (2018-04-14 09:45:31)
Offline
Pages: 1
Topic closed