Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Plugin] CA User Scripts

Featured Replies

This is fantastic... I was doing these via my own batch script. This is much easier! Thank you Squid!

 

A few thoughts/questions:

 

1) Can others share their scripts so we can incorporate into our system?

 

2) A little guidance for creating my own script... I have a script that executes a command inside one of my Dockers. The script goes something like:

 

docker exec -t -i 70201386b244 cp -R /config/folderA /app/sab/folderB/

The number above is the ID of the Docker I want to access. If I re-intsall the Docker, this number changes. Is there a way to switch out the docker ID with something that will survive a Docker re-install?

 

3) When doing something with Dynamix Schedules, am I correct to assume that it will run in the background?

 

Thanks,

 

H.

  • Replies 2.1k
  • Views 569.3k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • I could make up something long, convoluted, and technical as a reason why it doesn't do that but it would all be bs.  The simple answer is that when I did this, I never thought of that, and why it sti

  • Hi All - We have a fix and are publishing a Connect plugin update to fix it today. Thanks for letting us know.

  • @Squid I tried many commands and by that I found out that pkill does not kill (all) child processes: root@Thoth:/tmp# pgrep -f isleep2m | xargs --no-run-if-empty ps fp PID TTY STAT T

Posted Images

For my item 2) above, when I run the script, I get me message that says:

 

cannot enable tty mode on non tty input

 

My script is:

#!/bin/bash
echo "Updating Sickrage Edits"
echo "If failed, need to ensure ID of Docker is correct in the script."
docker exec -t -i 70201386b244 cp -R /config/sickrage-edits/gui/slick /app/sickrage/gui/

 

How can I fix this?

 

Thanks,

 

H.

1) Can others share their scripts so we can incorporate into our system?

Great idea. Maybe in a seperate thread though.

  • Author

For my item 2) above, when I run the script, I get me message that says:

 

cannot enable tty mode on non tty input

 

My script is:

#!/bin/bash
echo "Updating Sickrage Edits"
echo "If failed, need to ensure ID of Docker is correct in the script."
docker exec -t -i 70201386b244 cp -R /config/sickrage-edits/gui/slick /app/sickrage/gui/

 

How can I fix this?

 

Thanks,

 

H.

Not the expert on docker exec but I think it's because you're running it in interactive mode -i and it recognizes there is no console input. Try removing that switch

 

Sent from my LG-D852 using Tapatalk

 

 

  • Author

 

 

This is fantastic... I was doing these via my own batch script. This is much easier! Thank you Squid!

 

A few thoughts/questions:

 

1) Can others share their scripts so we can incorporate into our system?

 

2) A little guidance for creating my own script... I have a script that executes a command inside one of my Dockers. The script goes something like:

 

docker exec -t -i 70201386b244 cp -R /config/folderA /app/sab/folderB/

The number above is the ID of the Docker I want to access. If I re-intsall the Docker, this number changes. Is there a way to switch out the docker ID with something that will survive a Docker re-install?

 

3) When doing something with Dynamix Schedules, am I correct to assume that it will run in the background?

 

Thanks,

 

H.

1 just post it.

2 yeah I guess in case of a install reinstall or an update through dockerMan the id can change.  I'll bang together a script you can call with the name and it will return the id

3 anything scheduled to run here uses dynamix schedules.  Scripts all run in the background and if there are multiple scheduled they will run concurrently

 

Sent from my LG-D852 using Tapatalk

 

 

 

 

This is fantastic... I was doing these via my own batch script. This is much easier! Thank you Squid!

 

A few thoughts/questions:

 

1) Can others share their scripts so we can incorporate into our system?

 

2) A little guidance for creating my own script... I have a script that executes a command inside one of my Dockers. The script goes something like:

 

docker exec -t -i 70201386b244 cp -R /config/folderA /app/sab/folderB/

The number above is the ID of the Docker I want to access. If I re-intsall the Docker, this number changes. Is there a way to switch out the docker ID with something that will survive a Docker re-install?

 

3) When doing something with Dynamix Schedules, am I correct to assume that it will run in the background?

 

Thanks,

 

H.

1 just post it.

2 yeah I guess in case of a install reinstall or an update through dockerMan the id can change.  I'll bang together a script you can call with the name and it will return the id

3 anything scheduled to run here uses dynamix schedules.  Scripts all run in the background and if there are multiple scheduled they will run concurrently

 

Sent from my LG-D852 using Tapatalk

Can't you just use the name of the container? That is what I do when I run a docker exec.

  • Author

You guys would know better than I.  All I ever do with the various plugins is communicate with dockerman

 

Sent from my LG-D852 using Tapatalk

 

 

Can't you just use the name of the container? That is what I do when I run a docker exec.

 

Saarg... I cant believe it was as simple as that. Just tried it and it worked. Thank you.

 

1 just post it.

2 yeah I guess in case of a install reinstall or an update through dockerMan the id can change.  I'll bang together a script you can call with the name and it will return the id

3 anything scheduled to run here uses dynamix schedules.  Scripts all run in the background and if there are multiple scheduled they will run concurrently

 

Sent from my LG-D852 using Tapatalk

 

Thank you Squid... The Docker ID is not needed per Saarg... Removing the -i fixed the problem as well in my script. Thank you very much!!

  • Author

1) Can others share their scripts so we can incorporate into our system?

Great idea. Maybe in a seperate thread though.

I've created a separate thread for this HERE
  • 4 weeks later...

Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/

 

 

Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/

But if you already have the power down plugin, why is the script plugin involved?

  • Author

Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/

But if you already have the power down plugin, why is the script plugin involved?

Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions)

 

Will add  in array start and array stop to the frequency options.  Should take about 10 minutes for me tonight....

Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/

But if you already have the power down plugin, why is the script plugin involved?

Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions)

 

Will add  in array start and array stop to the frequency options.  Should take about 10 minutes for me tonight....

 

Exactly. This script is about not having to touch the command line.

 

Sounds good, will try it out when it's updated :-)

Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/

But if you already have the power down plugin, why is the script plugin involved?

Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions)

 

Will add  in array start and array stop to the frequency options.  Should take about 10 minutes for me tonight....

 

Exactly. This script is about not having to touch the command line.

 

Sounds good, will try it out when it's updated :-)

Ahh... You're one of those guys ;)

  • Author

Would it be possible to integrate this with Powerdown Package and specifically run scripts from shutdown / startup events. I'd like to run a script at startup instead of a cron schedule. So basically i need the script to be inside /boot/config/plugins/powerdown/rc.unRAID.d/

But if you already have the power down plugin, why is the script plugin involved?

Not that big a deal to handle (and then you basically will have a GUI to handle something you would normally have to do via the command line to do it with the powerdown functions)

 

Will add  in array start and array stop to the frequency options.  Should take about 10 minutes for me tonight....

 

Exactly. This script is about not having to touch the command line.

 

Sounds good, will try it out when it's updated :-)

Ahh... You're one of those guys ;)

So you must miss 6.0B6 with no dockerMan, and strictly docker run commands then

I'm trying to make a very basic script for one of my servers, and wonder if anyone can help as I'm clueless with them.

 

This is the scrip I need:

 

1-run mover

2-trim cache

3-check for array inactivity (monitor reads/writes?), if inactive for say 60 seconds go to 4

4-powerdown

 

1,2 and 4 are easy, any ideas how I can do 3?

  • Author

I'm trying to make a very basic script for one of my servers, and wonder if anyone can help as I'm clueless with them.

 

This is the scrip I need:

 

1-run mover

2-trim cache

3-check for array inactivity (monitor reads/writes?), if inactive for say 60 seconds go to 4

4-powerdown

 

1,2 and 4 are easy, any ideas how I can do 3?

Easy way for 3 is to check if all the disks are spun down:  ie the "color" is green-blink for all the disks within /var/local/emhttp/disks.ini  More or less implies no activity.  (alternatively, use hdparm to check)

 

To do it the way that you want is to check each disks numReads and numWrites (once again within disks.ini), sleep for 60 seconds, and then check again.  If all the values are the same, then go to 4.

 

I can bang together a php script later if it'll help (with a return code you can check) -> hate doing stuff like this in bash.

 

Easy way for 3 is to check if all the disks are spun down:  ie the "color" is green-blink for all the disks within /var/local/emhttp/disks.ini  More or less implies no activity.  (alternatively, use hdparm to check)

 

Thanks, the easy way would work for me, but like I said I'm totally clueless with scripts, how do I add a line to check if they're all spun down?

 

This is my current script:

 

/usr/local/sbin/mover
/sbin/fstrim -v /mnt/cache
/usr/bin/sleep 180
/usr/local/sbin/powerdown

 

I'd like to replace the sleep line with the check for spun down disks.

  • Author

lol  sure.. catch me as I'm doing the numReads / Writes version.  Gimme a couple min.  Assuming you want to exclude cache drive

 

lol  sure.. catch me as I'm doing the numReads / Writes version.  Gimme a couple min.  Assuming you want to exclude cache drive

 

If you're doing the other one I would still prefer it, avoids the server being on for an extra 15 minutes unnecessarily, the least you can set to spin down.

  • Author

lol  sure right when I finish the easy version.  Gotta eat and spend time with the wife.  I'll get back to it in a bit

 

#!/usr/bin/php
<?PHP
function startsWith($haystack, $needle) {
  return $needle === "" || strripos($haystack, $needle, -strlen($haystack)) !== FALSE;
}
exec("/usr/local/sbin/mover");
exec("/sbin/fstrim -v /mnt/cache");

$disks = parse_ini_file("/var/local/emhttp/disks.ini",true);

foreach ($disks as $disk) {
  if ( startsWith($disk['name'],"cache") ) { continue; }
  if ( $disk['name'] == "flash" ) { continue; }
  if ( (! strpos($disk['color'],"blink")) && (!strpos($disk['color'],"off")) ) {
    $flag = true;
  }
}
if ( ! $flag ) {
  exec("/usr/local/sbin/powerdown");
}

?>

  • Author

Problem with the other method in quick testing is that tuneable (poll_attributes) has to be set to be less than whatever the sleep is for since disks.ini is only updated at that frequency.  I believe that spin downs take effect in disks.ini immediately.

lol  sure right when I finish the easy version.  Gotta eat and spend time with the wife.  I'll get back to it in a bit

 

Thanks! No rush, I'll try this one tomorrow.

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.