[SCRIPT] create-autorun.sh

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
Post Reply
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

Haskell wrote: Tue Apr 28, 2020 5:27 am first of all thank you for writing this script, and helping out who's in need
Cheers mate! :D
Haskell wrote: Tue Apr 28, 2020 5:27 am ... and when the boot is completed, if I go to the scripts directory and execute them via './thescript.sh' they'll run just fine ...
Please note: autorun.sh executes scripts before QPKGs. If your scripts need to call QPKG applications that have not yet been re-integrated, they will fail.

If you do need to script installed QPKG applications, please use the RunLast QPKG instead of autorun. It's like autorun, but runs your scripts after all other QPKGs have been re-integrated.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Haskell
Starting out
Posts: 10
Joined: Mon May 27, 2019 2:30 am

Re: [SCRIPT] create-autorun.sh

Post by Haskell »

Thank you so much, I believe this is the point I was missing. cheers mate!
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

I'm a bit new to this, though I was a UNIX/Linux admin many years ago, but will https://git.io/create-autorun.sh work on the TVS-672N? I'm seeing reference to TS-xxx models in the script.

Can we not just use @reboot in the crontab? Pros/Cons?
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

RichJacot wrote: Wed May 06, 2020 4:20 am ... but will https://git.io/create-autorun.sh work on the TVS-672N? I'm seeing reference to TS-xxx models in the script.
You'll need to try it and see. :geek:
RichJacot wrote: Wed May 06, 2020 4:20 am Can we not just use @reboot in the crontab? Pros/Cons?
@reboot is not supported by QTS cron. :(

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

Well I guess it's not.

[~] # curl -skL https://git.io/create-autorun.sh | bash
create-autorun.sh (191105)

[ info ] NAS model: TS-X72 (TVS-672N)
[ info ] QTS version: 4.4.2 #20200410
[ info ] default volume: /share/CACHEDEV1_DATA

[ done ] DOM partition found (/dev/sde6)
[ done ] mounted (ext2) DOM partition at [/tmp/create-autorun.SPVDNB]
[ fail ] DOM tag-file was not found!
[ done ] unmounted (ext2) DOM partition

[ fail ] [autorun.sh] creation failed!

[~] #


I found one reference to "DOM tag-file was not found!" (in this thread) but it doesn't look like the guy ever replied back to OneCD's request.

Ideas?

Thanks,
Rich
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

RichJacot wrote: Wed May 06, 2020 8:51 pm I found one reference to "DOM tag-file was not found!" (in this thread) but it doesn't look like the guy ever replied back to OneCD's request.
It's possible that not every model NAS has a copy of [uLinux.conf] stored on the DOM. I don't have access to every model. :'

I've just uploaded an additional script for you to use that doesn't perform a check for this file. So, your download and execute command will be:

Code: Select all

<link removed>
This new script blindly adds a symlink on the mounted DOM partition that points to your new autorun.sh script processor on your default volume. You might try adding a test script into the scripts directory, enabling autorun in your QTS Control Panel, then rebooting your NAS. Does it work?
Last edited by OneCD on Thu May 07, 2020 6:20 am, edited 1 time in total.
Reason: removed link as it was invalid

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

Now I'm getting the following but also, I can't just go to the URL and view this nocheck script... Trying to view before running I get "No url found for create-autorun-nocheck.sh".

Just trying to run it I get:

[~] # curl -skL <link removed> | bash
bash: line 1: No: command not found
[~] #
Last edited by OneCD on Thu May 07, 2020 6:20 am, edited 1 time in total.
Reason: removed link as it was invalid
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

RichJacot wrote: Thu May 07, 2020 3:54 am [~] # curl -skL <link removed> | bash
bash: line 1: No: command not found
Bah, I forgot to register a new shortlink with git.io. :oops:

Oh well, try it with a direct link instead:

Code: Select all

curl -skL https://raw.githubusercontent.com/OneCDOnly/create-autorun/master/create-autorun-nocheck.sh | bash
Last edited by OneCD on Thu May 07, 2020 6:21 am, edited 1 time in total.
Reason: removed link as it was invalid

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

That worked. Thank you!

Now to test. Hopefully I'll have time after work today. ;-)
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

Well I guess it's been toooo many years since I've done much of any scripting...

The autorun appears to be working because the touch I put in my script works but the mount isn't working. :-(

Anyone know what I'm doing wrong? It runs by hand just fine.


[/share/CACHEDEV1_DATA/.system/autorun/scripts] # ll
total 12K
drwxr-xr-x 2 admin administrators 4.0K 2020-05-06 17:25 ./
drwxr-xr-x 3 admin administrators 4.0K 2020-05-06 15:24 ../
-rwxr-xr-x 1 admin administrators 134 2020-05-06 17:18 PlexTranscodeRAMDrive.sh*
-rw-r--r-- 1 admin administrators 0 2020-05-06 17:25 plxran


[/share/CACHEDEV1_DATA/.system/autorun/scripts] # cat PlexTranscodeRAMDrive.sh
#!/bin/sh
/bin/mount -t tmpfs -o size=16G tmpfs /plex.transcoding.tmp
/bin/touch /share/CACHEDEV1_DATA/.system/autorun/scripts/plxran
[/share/CACHEDEV1_DATA/.system/autorun/scripts] #


The /plex.transcoding.tmp exists. I created that when I was toying with it manually.

drwxrwxrwx 2 admin administrators 40 2020-05-06 17:27 plex.transcoding.tmp/
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

RichJacot wrote: Thu May 07, 2020 6:31 am /bin/mount -t tmpfs -o size=16G tmpfs /plex.transcoding.tmp
Hmm, how much RAM is there in your NAS?

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

32GB - 2 x 16
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

Are you creating the [/plex.transcoding.tmp] directory first - before mounting tmpfs to it? It won't be there after a reboot, so you'll need to recreate it after every boot.

Have you checked the stdout and stderr from autorun.sh?

Code: Select all

cat /var/log/autorun.log

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
RichJacot
Starting out
Posts: 38
Joined: Fri Apr 24, 2020 9:16 pm

Re: [SCRIPT] create-autorun.sh

Post by RichJacot »

I checked the autorun.log and it appears to be doing what should...

[/share/CACHEDEV1_DATA/.system/autorun/scripts] # cat /var/log/autorun.log
Wed May 6 17:25:26 CDT 2020 ----- running autorun.sh -----
Wed May 6 17:25:26 CDT 2020 - /share/CACHEDEV1_DATA/.system/autorun/scripts/PlexTranscodeRAMDrive.sh
[/share/CACHEDEV1_DATA/.system/autorun/scripts] #


The /plex.transcoding.tmp exists ahead of time. I created the dir as a mount point to test with several days ago. I show it and it's permissions in the prior post.
TVS-672N - 32GB - 4.5.1.1594 - Static volume - RAID5 - 6 x 10TB Ironwolf --- Thick Volume RAID1 - 2 x 500GB M.2 SSD - CT500P1SSD8 in a QM2-2P10G1TA
TS-453B - 16GB - 4.5.1.1540 - Static volume - RAID5 - 4 x 4TB WD Red
User avatar
OneCD
Guru
Posts: 12146
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] create-autorun.sh

Post by OneCD »

RichJacot wrote: Thu May 07, 2020 6:52 am I checked the autorun.log and it appears to be doing what should...
Cool, this means you can perform tests within your script and the output will be captured here.
RichJacot wrote: Thu May 07, 2020 6:52 am The /plex.transcoding.tmp exists ahead of time. I created the dir as a mount point to test with several days ago. I show it and it's permissions in the prior post.
And this location (off the root filesystem) remains even after you have rebooted the NAS? That would be a first! :shock:

The directory entry you posted doesn't show the full path to your transcoding directory.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Post Reply

Return to “Users' Corner”