Page 1 of 1

script for rc.shutdown?

Posted: 06 Apr 2015, 21:01
by mtrueman
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?

Re: script for rc.shutdown?

Posted: 06 Apr 2015, 22:12
by donald
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..

Re: script for rc.shutdown?

Posted: 07 Apr 2015, 01:42
by brokenman
Create the file: /etc/rc.d/rc.local_shutdown

Re: script for rc.shutdown?

Posted: 07 Apr 2015, 23:26
by mtrueman
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?

Re: script for rc.shutdown?

Posted: 08 Apr 2015, 02:14
by Ed_P
mtrueman wrote:On Puppy Linux I simply added the line "cp -r ~/homework/* /mnt/sdb1/homework/" to Puppy's /etc/rc.d/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.

Re: script for rc.shutdown?

Posted: 08 Apr 2015, 03:44
by mtrueman
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.

Re: script for rc.shutdown?

Posted: 08 Apr 2015, 04:13
by Ed_P
mtrueman wrote: (without the initial ~)
oops! :oops:
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,
Actually this is the approach I use.

However maybe this posting: http://forum.porteus.org/viewtopic.php? ... 982#p20762 could help determine the location of the command when shutting down. :wink:

Re: script for rc.shutdown?

Posted: 08 Apr 2015, 09:33
by donald
@ 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.

Re: script for rc.shutdown?

Posted: 08 Apr 2015, 12:18
by Bogomips
Or you could magic folder '/home/guest/homework/' and save yourself the bother. 8)

Re: script for rc.shutdown?

Posted: 08 Apr 2015, 18:44
by mtrueman
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.