Jump to content
SlrG

[Plugin] Advanced Copy and Move for unRAID v6.6.7 and later

8 posts in this topic Last Reply

Recommended Posts

Posted (edited)

advCPaMV

Support the plugin?

Donate

 

This is my Advanced Copy and Move Plugin for unRAID v6.6.7 and later.

 

Please feel free to test it and report back if there are problems.

 

To install it:

 

v6.6.7 and later:

Install it using CA or in the unRAID plugin manager by installing from github:

https://raw.githubusercontent.com/SlrG/unRAID/master/Plugins/advCPaMV.plg

 

Description:

 

This plugin provides advanced cp and mv shell command alternatives named gcp and gmv that were created by applying the advcpmv-0.7-8.25.patch (from here) on the coreutils version used by unRAID.

 

But what does it do?

gcp and gmv are the normal cp and mv shell commands extended to support the parameters -g or --progress-bar, which will show the progress of the copy or move commands.


It will look like this while in progress:

gcp -rg temp/ temp1

2 files copied so far...                             3.0 GiB /   5.0 GiB
[================================>                              ] 60.0 %
Copying at   2.6 GiB/s (about 0h 0m 12s remaining)
temp/file2.txt                                       1.0 GiB /   1.0 GiB
[=============================================================> ] 99.9 %

And afterwards it will show a summary of the copy process:

5 files (  5.0 GiB) copied in 44.5 seconds (115.2 MiB/s).

SlrG

Edited by SlrG
remove topic tag

Share this post


Link to post
Posted (edited)

Well I have and I made the aliases to always use the -g switch too, as I really like to be able to view the progress of those operations. But I left that out of the plugin, so the users can decide for themselves.

 

My aliases from my .bash_profile look like this:

alias cp="gcp -g"
alias mv="gmv -g"
alias n="sudo -u nobody"
alias ncp="sudo -u nobody gcp -g"
alias nmv="sudo -u nobody gmv -g"

The last three allow me to run commands, copy or move files from a root shell as user nobody, which is the default file owner on unRAID. Otherwise the new files will have root as owner, which might cause problems later on.

Edited by SlrG
added aliases

Share this post


Link to post
On 4/24/2019 at 2:41 AM, SlrG said:

Well I have and I made the aliases to always use the -g switch too, as I really like to be able to view the progress of those operations. But I left that out of the plugin, so the users can decide for themselves.

 

My aliases from my .bash_profile look like this:


alias cp="gcp -g"
alias mv="gmv -g"
alias n="sudo -u nobody"
alias ncp="sudo -u nobody gcp -g"
alias nmv="sudo -u nobody gmv -g"

The last three allow me to run commands, copy or move files from a root shell as user nobody, which is the default file owner on unRAID. Otherwise the new files will have root as owner, which might cause problems later on.

I added the aliases to .bash_profile-

# console coloring for kool kids
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

# if this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# impersonate a user
alias user="su -ls /bin/bash"

alias v="ls -lA"

# advanced copy aliases
alias cp="gcp -g"
alias mv="gmv -g"
alias n="sudo -u nobody"
alias ncp="sudo -u nobody gcp -g"
alias nmv="sudo -u nobody gmv -g"

How do I get them to survive a reboot?

Share this post


Link to post

Copy the .bash_profile to your flash (/boot/config/) and add the following line to your go file:

ln -sf /boot/config/.bash_profile /root/.bash_profile

This will create a link overwriting the original file and pointing to the new one on the flash. Changing something in the original location will be put on the flash automatically and thus survive a reboot.

Share this post


Link to post

Thanks.

 

After my previous post I was doing a little reading about .bash_profile vs .bashrc. Just want to confirm that the aliases need to be added to .bash_profile to work in the built in terminal window?

Share this post


Link to post

@wgstarks

When trying just now, it works fine in the built in terminal when using .bash_profile.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.