Copy the root file from chron with a script?

New to Puppy and have questions? Start here

Moderator: Forum moderators

Post Reply
User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

Copy the root file from chron with a script?

Post by theroar84 »

I have a simple script that copies a few files from a USB stick for me. Fossa64 9.5 Multiple Frugal on EXT4 hard drives.

I have setup a few jobs in pSchedule and want to update the root file on a few PC's. The script can copy normal files fine... but it does not "see" the root file.

This is the script. The first line works as expected and adds the scripts I call in the updated pSchedule list. The second line skips root, but did copy the test.txt file I added to the folder. Thanks again for all the tips!

#!/bin/bash
cp /mnt/sdb1/1a/app/. /root/my-applications/bin/
cp /mnt/sdb1/1a/nroot/. /var/spool/cron/crontabs/

This image https://imgur.com/a/n0REx1Q shows how the text file copied fine... but no root update.

Last edited by theroar84 on Mon Jan 01, 2024 3:35 pm, edited 3 times in total.

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

User avatar
Chelsea80
Posts: 352
Joined: Tue Mar 09, 2021 12:44 am
Has thanked: 46 times
Been thanked: 73 times

Re: Copy the root file from chron with a script?

Post by Chelsea80 »

@ theroar84

FYI:

This what I see on your post, all OK
.

On Forum.png
On Forum.png (159.58 KiB) Viewed 504 times

.
This what I see when clicking on above
.

On Link.png
On Link.png (14.17 KiB) Viewed 504 times

.
Best wishes

Chelsea80

Chelsea80

1. BionicPup32+28 19.03 - Linux 4.9.163 - lxpup - 32-pae [i686] - (UPup Bionic Beaver)
....Frugal Install - Internal HDD - Gateway MX8716b - HDD 120GB - RAM 2GB

2. Friendly-Bionic32 v1.1
....USB Stick 2GB

User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

Re: Copy the root file from chron with a script?

Post by theroar84 »

Thank you. I will see what happens when I post it as a image instead of just dropping the link in there.

Update: I think I was told before it is a Imgur thing. When I add it as a image it gives an error... paste the link... the image shows up, but as you noted if you click it you get an error. My final strategy was to add the link as a url above, then paste the imgur link so it is visible in the post too.

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

User avatar
fredx181
Posts: 2881
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 338 times
Been thanked: 1207 times
Contact:

Re: Copy the root file from chron with a script?

Post by fredx181 »

@theroar84 This should work:
cp -rT /mnt/sdb1/1a/nroot/ /var/spool/cron/crontabs/ (-r = recursive and -T (--no-target-directory) option, this copies everything, including hidden files, symlinks, folders).

EDIT: Or if you want to force overwriting (-f option) :
cp -rfT /mnt/sdb1/1a/nroot/ /var/spool/cron/crontabs/
Or if you want all permissions to be preserved too (-a option = archive)
cp -afT /mnt/sdb1/1a/nroot/ /var/spool/cron/crontabs/

User avatar
Trapster
Posts: 173
Joined: Sat Aug 01, 2020 7:44 pm
Has thanked: 1 time
Been thanked: 44 times

Re: Copy the root file from chron with a script?

Post by Trapster »

Since you have no suffix on the "root" file, use * instead of *.*

Code: Select all

cp /mnt/sdb1/1a/nroot/* /var/spool/cron/crontabs/
User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

Re: Copy the root file from chron with a script?

Post by theroar84 »

Thanks tons for all the tips! Really cool to add the extra commands to the script to force the exact results. 👍

The archive option was the one that I finally settled on. Keeping the permissions was sweet. Thanks fredx181!

cp -afT /mnt/sdb1/1a/nroot/ /var/spool/cron/crontabs/
Or if you want all permissions to be preserved too (-a option = archive)

I did find out that just removing the * for the extension did not work. A cool option to test though. I never would have thought of that. 🤦‍♂️

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

User avatar
theroar84
Posts: 80
Joined: Sat May 08, 2021 4:21 pm
Location: US
Has thanked: 33 times
Been thanked: 4 times
Contact:

Re: Copy the root file from chron with a script?

Post by theroar84 »

Just wanted to say thanks again. The update process was so slick.

Running Fossa64 9.5 Multiple PC's Frugal Installs on EXT4 hard drives. Multiple Frugals per PC too.

Post Reply

Return to “Beginners Help”