script for rc.shutdown?
script for rc.shutdown?
I noticed a discussion on editing rc.local for startup. I can't find any similar discussion for shutdown. On Puppy Linux I simply added the line "cp -r ~/homework/* /mnt/sdb1/homework/" to Puppy's /etc/rc.d/rc.shutdown. This copied the contents of the homework folder in home to the homework folder in the root of the USB so that I could plug the USB into a running Windows and have access to these otherwise inaccessible files. I can't seem to do this reliably using Porteus. Any advice?
-
- Full of knowledge
- Posts: 1985
- Joined: 17 Jun 2013, 13:17
- Distribution: Porteus 3.2.2 XFCE 32bit
- Location: Germany
Re: script for rc.shutdown?
Hi
I think you will find what you're searching for at
/etc/lxdm/PreShutdown
EDIT
these files are not executed by default,so better forget about this..
I think you will find what you're searching for at
/etc/lxdm/PreShutdown
EDIT
these files are not executed by default,so better forget about this..
Last edited by donald on 08 Apr 2015, 09:40, edited 1 time in total.
- brokenman
- Site Admin
- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
- Contact:
Re: script for rc.shutdown?
Create the file: /etc/rc.d/rc.local_shutdown
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
Re: script for rc.shutdown?
I tried both these solutions. Neither worked. Fresh install of Porteus on clean USB. Has anyone managed to write a script for Porteus to transfer files from the home directory to the USB root on shutdown?
- Ed_P
- Contributor
- Posts: 7672
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Re: script for rc.shutdown?
I believe in Porteus the command should be "cp -r ~/home/guest/* /mnt/sdb1/homework/". Try it in terminal mode to verify it functions.mtrueman wrote:On Puppy Linux I simply added the line "cp -r ~/homework/* /mnt/sdb1/homework/" to Puppy's /etc/rc.d/rc.shutdown.
Ed
Re: script for rc.shutdown?
Thanks Ed, following your suggestion, I altered the script to
cp -r /home/guest/homework/* /mnt/sdb1/homework/
(without the initial ~)
Much like my original script, this worked in terminal and it worked (for the lxdm PreShutdown) on double clicking the script. It didn't work as I intended, transferring files from Home to USB root on shutdown.
I suppose I could put an icon on the desktop and let the users double click it to make their files accessible to Windows when shutting down, but I thought it should be possible to automate the procedure, like the designers of Puppy had in mind.
cp -r /home/guest/homework/* /mnt/sdb1/homework/
(without the initial ~)
Much like my original script, this worked in terminal and it worked (for the lxdm PreShutdown) on double clicking the script. It didn't work as I intended, transferring files from Home to USB root on shutdown.
I suppose I could put an icon on the desktop and let the users double click it to make their files accessible to Windows when shutting down, but I thought it should be possible to automate the procedure, like the designers of Puppy had in mind.
- Ed_P
- Contributor
- Posts: 7672
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Re: script for rc.shutdown?
oops!mtrueman wrote: (without the initial ~)

Actually this is the approach I use.I suppose I could put an icon on the desktop and let the users double click it to make their files accessible to Windows when shutting down,
However maybe this posting: http://forum.porteus.org/viewtopic.php? ... 982#p20762 could help determine the location of the command when shutting down.

Ed
-
- Full of knowledge
- Posts: 1985
- Joined: 17 Jun 2013, 13:17
- Distribution: Porteus 3.2.2 XFCE 32bit
- Location: Germany
Re: script for rc.shutdown?
@ mtrueman
I made a fresh install (xfce 3.1 on fat32 usb-flash + savedat container)
and the file
/etc/rc.d/rc.local_shutdown was already present.
But it is not executeable by default.
I used this line:
cp -r /home/guest/homework/* /mnt/sdb1/homework/
and made the file executeable,
created the 2 "homework" folder,
shutdown,restart aaaand BINGO.
I made a fresh install (xfce 3.1 on fat32 usb-flash + savedat container)
and the file
/etc/rc.d/rc.local_shutdown was already present.
But it is not executeable by default.
I used this line:
cp -r /home/guest/homework/* /mnt/sdb1/homework/
and made the file executeable,
created the 2 "homework" folder,
shutdown,restart aaaand BINGO.
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: script for rc.shutdown?
Or you could magic folder '/home/guest/homework/' and save yourself the bother. 8)
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
Re: script for rc.shutdown?
Thank you Donald, I hadn't realized that the file had to be made executable.
(sudo chmod +x rc.local_shutdown)
Good of you to point this out. It is performing as I intended. Apparently, with Puppy, the file is already executable.
(sudo chmod +x rc.local_shutdown)
Good of you to point this out. It is performing as I intended. Apparently, with Puppy, the file is already executable.