[Plugin] CA User Scripts


Recommended Posts

Just now, mattw said:

No, I did not.  I was able to run the New Config properly and check the box that parity was valid.  I would run a parity check if needed.

Parity is NOT valid, unless you successfully completed the dd to zero the drive. I was under the impression you gave up before it completed.

Link to comment
Just now, trurl said:

If you successfully completed clearing the md device, then parity is valid

Yes, I screwed up... I should not do things when I am tired... It just dawned on me that because of all of the problems with the shutdown that I never ran the zero command.  I just removed the drive.  So, I guess I do really need to rebuild parity!  Please correct me if I am wrong.

Link to comment
2 minutes ago, JonathanM said:

Parity is NOT valid, unless you successfully completed the dd to zero the drive. I was under the impression you gave up before it completed.

I did abort the GUI run and was going to run the cli command and got distracted by the shutdown issues... so it appears that I need to rebuild parity.  Correct.

Link to comment
5 minutes ago, trurl said:

New Config without the disk and Rebuild parity is the simplest and fastest way to remove a disk.

Parity rebuild started...  I really do feel like an idiot at this point.

 

So, I assume that it will find and fix errors since I did remove a disk that was likely not fully zerod out.  On the plus side, my array is running faster with that old Segate 7200.11 drive out of the picture.

Edited by mattw
Link to comment

I'm trying to mount an rclone volume via userscript. If I run rclone mount, I get this error in Windows when the volume is accessed via samba: "You require permission from TOWER\root to make changes..."

 

It works just fine if I run the rclone mount command via unraid terminal. It seems like the share is read-only if I run the script in userscript. Any idea what I'm missing here or if I'm doing something incorrectly?

 

fusermount -u -z /mnt/disks/Gdrive
sudo umount -l /mnt/disks/Gdrive
mkdir -p /mnt/disks/Gdrive
rclone mount Gdrive: /mnt/disks/Gdrive --allow-other --max-read-ahead 1024k
Link to comment
  • 3 weeks later...
On 7/12/2023 at 2:59 PM, standbymeintothewild said:

Hi, just noticed that all my custom cron scheduling is gone, is this a know issue with a known solution? All scripts with blank space next to it should have a cron statment.
And then i refreshed the "_media2" script also lost its settings.

bilde.png

Seeing this behaviour on a different instance of unraid. Ha less scripts there, and it had just messed with the custom cron. But when i add new scripts i loose the timecontrols. Any help?bilde.thumb.png.940946cb2173223b26bbc78b0d5ca450.png

Link to comment
4 hours ago, armin0012002 said:

delete userscript folder still same issue

and rebootet ?

 

you wont kill any running processes like this, its just a info where the scripts are stored ...

 

if i wanted to kill a running process now, i would look for the process and try to kill them

 

root@AlsServer:~# ps x | grep -i sensor
 8490 ?        SL     0:00 /usr/bin/php /usr/local/emhttp/plugins/user.scripts/startBackground.php /tmp/user.scripts/tmpScripts/sensor.json/script
 8537 ?        S      0:00 sh -c /tmp/user.scripts/tmpScripts/sensor.json/script  >> /tmp/user.scripts/tmpScripts/sensor.json/log.txt 2>&1
 8540 ?        S      0:11 /bin/bash /tmp/user.scripts/tmpScripts/sensor.json/script
 8814 ?        S      0:00 /bin/bash /tmp/user.scripts/tmpScripts/sensor.json/script
 8834 pts/0    S+     0:00 grep -i sensor
root@AlsServer:~#

 

this is a running userscript process here

  • Like 1
Link to comment

There seems to be different home directories depending on whether a script is invoked in the background or not. I have created a simple script with this contents:

#!/bin/bash
ls ~ -al

When running in foreground, it lists the /root directory:

drwx--x--- 7 root root 300 Jul 17 17:31 .
drwxr-xr-x 20 root root 440 Jul 17 17:24 ..
-rw------- 1 root root 16 Jul 17 17:31 .bash_history
-rw-r--r-- 1 root root 316 Jul 15 04:27 .bash_profile
-rwxr-xr-x 1 root root 60 Jul 15 04:27 .bashrc
drwx------ 3 root root 60 Jul 17 17:20 .cache
drwxr-xr-x 4 root root 80 Jul 17 17:20 .config
lrwxrwxrwx 1 root root 30 Jul 15 04:27 .docker -> /boot/config/plugins/dockerMan
drwx------ 3 root root 60 Jul 17 17:20 .local
drwx------ 2 root root 60 Jul 17 17:22 .screen
lrwxrwxrwx 1 root root 21 Jul 15 04:27 .ssh -> /boot/config/ssh/root
-rw-r--r-- 1 root root 180 Jul 17 17:23 .wget-hsts
-rw------- 1 root root 7606 Jul 17 17:20 keyfile
-rw-rw-rw- 1 root root 28512 Jul 17 17:21 patch.sh

When running in background, it lists the / directory:

drwxr-xr-x  20 root root  440 Jul 17 17:24 .
drwxr-xr-x  20 root root  440 Jul 17 17:24 ..
-rw-r--r--   1 root root  228 Jul 17 17:20 .wget-hsts
drwxr-xr-x   2 root root 3820 Jul 17 17:20 bin
drwx------  10 root root 4096 Jan  1  1970 boot
drwxr-xr-x  18 root root 3840 Jul 17 17:24 dev
drwxr-xr-x  63 root root 3340 Jul 17 17:24 etc
drwxr-xr-x   2 root root   40 Jul 15 04:27 home
drwxr-xr-x   2 root root    0 Jul 17 17:20 hugetlbfs
lrwxrwxrwx   1 root root   10 Jul 15 04:27 init -> /sbin/init
drwxr-xr-x   1 root root  100 Jun  9 21:34 lib
drwxr-xr-x   7 root root 4440 Jul 17 17:20 lib64
drwxr-xr-x  13 root root  260 Jul 17 17:24 mnt
drwxrwxrwx   4 root root   80 Jul 17 17:24 opt
dr-xr-xr-x 632 root root    0 Jul 17 17:19 proc
drwx--x---   7 root root  300 Jul 17 17:31 root
drwxr-xr-x  19 root root 1180 Jul 17 17:24 run
drwxr-xr-x   2 root root 5400 Jul 17 17:20 sbin
dr-xr-xr-x  13 root root    0 Jul 17 17:19 sys
drwxrwxrwt  16 root root  440 Jul 17 17:34 tmp
drwxr-xr-x   1 root root  240 Jul 16 12:08 usr
drwxr-xr-x  15 root root  360 Jul 17 17:20 var

Would it be possible to use the /root directory when running in background also?

Link to comment

Hello,

 

Curious if anyone has converted their user scripts folder to a git repo to keep things in sync? Not sure how the USB would handle .git and other special files. Since this is effectively code, I'm hoping to keep it up in my git repos if possible.

 

 

Link to comment

Hello everybody.
I use rsync to sync files between a server at work and home.
When I run the rsync command on the command line, I get the following log:

Quote

receiving incremental file list
./
.streams/0C/85/
.streams/10/32/
.streams/14/
.streams/2C/ED/

....

ПРОЕКТИ/Шамрила, 7/
ПРОЕКТИ/Шумовые характеристики Вило/
ПРОЕКТИ/Шумского/
ПРОЕКТИ/Щекавицька 46/
ПРОЕКТИ/с.Щасливе ТОВ ''Белла-Трейд''/
ПРОЕКТИ/тупик Тверський,10-а/
Потапенко/
Програми/
Регламенты/
Розпендовский/
ТО Варшавка 8.1 и 8.3/
ТО счета ноябрь/
Тарас/

Number of files: 291,762 (reg: 246,967, dir: 44,795)
Number of created files: 127 (reg: 116, dir: 11)
Number of deleted files: 0
Number of regular files transferred: 152
Total file size: 713,417,137,418 bytes
Total transferred file size: 1,189,231,808 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 9,273,155
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 50,362
Total bytes received: 10,302,212

sent 50,362 bytes  received 10,302,212 bytes  16,792.50 bytes/sec
total size is 713,417,137,418  speedup is 68,912.05 (DRY RUN)


When I execute the same command as a script in Bash, I get the following log:

Quote

2023-07-18 02:00:01
Папка All

receiving incremental file list
./
.streams/0C/85/
.streams/10/32/

...

\#320\#242\#320\#262\#320\#265\#321\#200\#321\#201\#321\#214\#320\#272\#320\#270\#320\#271,10-\#320\#260/
\#320\#237\#320\#276\#321\#202\#320\#260\#320\#277\#320\#265\#320\#275\#320\#272\#320\#276/
\#320\#237\#321\#200\#320\#276\#320\#263\#321\#200\#320\#260\#320\#274\#320\#270/
\#320\#240\#320\#265\#320\#263\#320\#273\#320\#260\#320\#274\#320\#265\#320\#275\#321\#202\#321\#213/
\#320\#240\#320\#276\#320\#267\#320\#277\#320\#265\#320\#275\#320\#264\#320\#276\#320\#262\#321\#201\#320\#272\#320\#270\#320\#271/
\#320\#242\#320\#236 \#320\#222\#320\#260\#321\#200\#321\#210\#320\#260\#320\#262\#320\#272\#320\#260 8.1 \#320\#270 8.3/
\#320\#242\#320\#236 \#321\#201\#321\#207\#320\#265\#321\#202\#320\#260 \#320\#275\#320\#276\#321\#217\#320\#261\#321\#200\#321\#214/
\#320\#242\#320\#260\#321\#200\#320\#260\#321\#201/

Number of files: 291,664 (reg: 246,880, dir: 44,784)
Number of created files: 176 (reg: 164, dir: 12)
Number of deleted files: 0
Number of regular files transferred: 220
Total file size: 713,192,394,036 bytes
Total transferred file size: 1,469,296,164 bytes
Literal data: 1,357,771,466 bytes
Matched data: 111,524,698 bytes
File list size: 9,396,061
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 1,217,662
Total bytes received: 1,368,534,084

sent 1,217,662 bytes  received 1,368,534,084 bytes  1,690,008.32 bytes/sec
total size is 713,192,394,036  speedup is 520.67


It can be seen that in Bash there is a problem with the display of Cyrillic letters, and not all of them, but only those that are returned to rsync as path elements or file names. At the same time, these files on the disk after synchronization have a correct name that I can read.

 

The script itself looks something like this:

#!/bin/bash
exec 1>>/boot/config/plugins/user.scripts/scripts/***/work.log
date +"%F %T"
echo "Папка All"
echo ""
rsync -av --progress --stats -r -u -tgo -p -l --password-file=[PARAMETER] --exclude=*@*/ rsync://rsync@IP:PORT/All /mnt/user/backup/


Does anyone know if it is possible to fix something in the bash properties so that it is correct?

Link to comment
23 hours ago, Stokkes said:

Hello,

 

Curious if anyone has converted their user scripts folder to a git repo to keep things in sync? Not sure how the USB would handle .git and other special files. Since this is effectively code, I'm hoping to keep it up in my git repos if possible.

 

 

If you use the official Unraid USB backup, it's already a git repo.

Link to comment
  • 2 weeks later...

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.