script for rc.shutdown?

Post here if you are a new Porteus member and you're looking for some help.
Post Reply
mtrueman
White ninja
White ninja
Posts: 4
Joined: 01 Apr 2015, 23:54
Distribution: XFCE
Location: mexico

script for rc.shutdown?

Post#1 by mtrueman » 06 Apr 2015, 21:01

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?

donald
Full of knowledge
Full of knowledge
Posts: 1219
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: script for rc.shutdown?

Post#2 by donald » 06 Apr 2015, 22:12

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..
Last edited by donald on 08 Apr 2015, 09:40, edited 1 time in total.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5574
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: script for rc.shutdown?

Post#3 by brokenman » 07 Apr 2015, 01:42

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.

mtrueman
White ninja
White ninja
Posts: 4
Joined: 01 Apr 2015, 23:54
Distribution: XFCE
Location: mexico

Re: script for rc.shutdown?

Post#4 by mtrueman » 07 Apr 2015, 23:26

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?

User avatar
Ed_P
Contributor
Contributor
Posts: 3320
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: script for rc.shutdown?

Post#5 by Ed_P » 08 Apr 2015, 02:14

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.
Ed

mtrueman
White ninja
White ninja
Posts: 4
Joined: 01 Apr 2015, 23:54
Distribution: XFCE
Location: mexico

Re: script for rc.shutdown?

Post#6 by mtrueman » 08 Apr 2015, 03:44

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.

User avatar
Ed_P
Contributor
Contributor
Posts: 3320
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: script for rc.shutdown?

Post#7 by Ed_P » 08 Apr 2015, 04:13

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: viewtopic.php?f=81&t=2982#p20762 could help determine the location of the command when shutting down. :wink:
Ed

donald
Full of knowledge
Full of knowledge
Posts: 1219
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Re: script for rc.shutdown?

Post#8 by donald » 08 Apr 2015, 09:33

@ 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.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2563
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: script for rc.shutdown?

Post#9 by Bogomips » 08 Apr 2015, 12:18

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

mtrueman
White ninja
White ninja
Posts: 4
Joined: 01 Apr 2015, 23:54
Distribution: XFCE
Location: mexico

Re: script for rc.shutdown?

Post#10 by mtrueman » 08 Apr 2015, 18:44

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.

Post Reply