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

11 hours ago, Kurotaku said:


pidof isn't reliable with scripts because basename might just return names like bash or sh.


You could do sth rly simple like that (if you don't mind skipping syncs when another sync is running):

#!/bin/bash

lock_file="/tmp/scriptname.lock";

if [ -f "${lock_file}" ]; then
    echo "Script is already running";
    exit 1;
fitouch "${lock_file}";

echo "Starting rsync process...";

rm -f "${lock_file}";

Hey thanks for that example, i'll try that out! I for sure do not wanting it to run twice. What happens is the script catches up to itself due to large files and then it starts deleting the file in progress by the other process.

My only question is what happens when I click the abort script, do I need to go delete the lock file manually?

  • Replies 2.1k
  • Views 570k
  • 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

17 minutes ago, nerbonne said:

Hey thanks for that example, i'll try that out! I for sure do not wanting it to run twice. What happens is the script catches up to itself due to large files and then it starts deleting the file in progress by the other process.

My only question is what happens when I click the abort script, do I need to go delete the lock file manually?


With abort it would not delete the file, you would need to delete the file first manually, or create another script which deletes it.
As for me I personally always just use python scripts.
Means the bash script calling py /mnt/cache/scripts/script.py for me, bcs Its much better syntax and you can do much more with python, like checks if the programm already running etc.

Just ask Claude/ChatGPT or Gemini to create scripts for stuff like that, thats what I do on daily basis.

As I'm currently working on a big and maybe last major release version of User Scripts Enhanced, I will may in the future create a Standalone version for User Scripts Enhanced which allows then for me to implement stuff like this, that you can't start the same script at the same time by default.
But that will take a lot time, and first my other 2 new Plugins must be finished :)

Edited by Kurotaku

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.