[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: 12137
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] autorun.sh installer

Post by OneCD »

archimed7592 wrote:There is an order if QNAP initialization, it looks somewhat like this:
  1. ...
  2. LCD shows Starting Service Please wait
  3. ...
  4. autorun.sh
  5. ...
  6. Optware initialization
  7. ...
  8. QNAP beeps, initialization is complete
Thanks. How did you determine this? :geek:

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
OneCD
Guru
Posts: 12137
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] autorun.sh installer

Post by OneCD »

I tried out QNAP's Malware Remover tool today - and found that it detects and removes the autorun.sh symlink this installer script creates.

Here's an extract from QNAP's Malware Remover:

Code: Select all

TMP_CONFIG="/tmp/config"
FILES="autorun.sh x86.tar.gz X86.tar.gz arm.tar.gz"
for f in $FILES; do
  if [ -f $TMP_CONFIG/$f ]; then
    ISCLEAN="N"
    rm -f $TMP_CONFIG/$f
    /sbin/write_log "[MalwareRemover] Malware removed: $TMP_CONFIG/$f" 4
  fi
done
So, an entry will appear in your NAS system log as:
[MalwareRemover] Malware removed: /tmp/config/autorun.sh
... and your autorun script(s) will not be executed on boot.

To fix this: run this installer script again.

However, if you leave the Malware Remover QPKG enabled, it will run a scan again each day at 3am, or on the next NAS reboot - which will remove the autorun.sh symlink again. To prevent this occurring, ensure you 'stop' the Malware Remover QPKG in the App Center.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
andrew_ho_ka
New here
Posts: 3
Joined: Thu Dec 22, 2016 4:31 pm

Re: [SCRIPT] autorun.sh installer

Post by andrew_ho_ka »

OneCD wrote:I tried out QNAP's Malware Remover tool today - and found that it detects and removes the autorun.sh symlink this installer script creates.

Here's an extract from QNAP's Malware Remover:

Code: Select all

TMP_CONFIG="/tmp/config"
FILES="autorun.sh x86.tar.gz X86.tar.gz arm.tar.gz"
for f in $FILES; do
  if [ -f $TMP_CONFIG/$f ]; then
    ISCLEAN="N"
    rm -f $TMP_CONFIG/$f
    /sbin/write_log "[MalwareRemover] Malware removed: $TMP_CONFIG/$f" 4
  fi
done
So, an entry will appear in your NAS system log as:
[MalwareRemover] Malware removed: /tmp/config/autorun.sh
... and your autorun script(s) will not be executed on boot.

To fix this: run this installer script again.

However, if you leave the Malware Remover QPKG enabled, it will run a scan again each day at 3am, or on the next NAS reboot - which will remove the autorun.sh symlink again. To prevent this occurring, ensure you 'stop' the Malware Remover QPKG in the App Center.

Hello! I want to mount a nfs folder automatically each time when the system startup. I found for few days and there is no official way to do this in the nas. The only way seems to run a script.
And it also seems that there is no official way to run the script automatically each time when the system startup.
Finally, I find this post and it seems that this is what I need.

BUT, it is saying that, the Malware Remover QPKG will remove the startup script.
I want to keep the Malware Remover qpkg and keep it running everyday to secure my files.
But, it is not make sense to run the installer manually every time...

Are there any other way that I can automatically run just one command at each startup in the qnap nas?
"mount -t nfs /my-nfs-ip:/nfsfolder /share/Public/nfsfolder"

my machine: qnap TS-453A

Thank you very much!
andrew_ho_ka
New here
Posts: 3
Joined: Thu Dec 22, 2016 4:31 pm

Re: [SCRIPT] autorun.sh installer

Post by andrew_ho_ka »

andrew_ho_ka wrote:
OneCD wrote:I tried out QNAP's Malware Remover tool today - and found that it detects and removes the autorun.sh symlink this installer script creates.

Here's an extract from QNAP's Malware Remover:

Code: Select all

TMP_CONFIG="/tmp/config"
FILES="autorun.sh x86.tar.gz X86.tar.gz arm.tar.gz"
for f in $FILES; do
  if [ -f $TMP_CONFIG/$f ]; then
    ISCLEAN="N"
    rm -f $TMP_CONFIG/$f
    /sbin/write_log "[MalwareRemover] Malware removed: $TMP_CONFIG/$f" 4
  fi
done
So, an entry will appear in your NAS system log as:
[MalwareRemover] Malware removed: /tmp/config/autorun.sh
... and your autorun script(s) will not be executed on boot.

To fix this: run this installer script again.

However, if you leave the Malware Remover QPKG enabled, it will run a scan again each day at 3am, or on the next NAS reboot - which will remove the autorun.sh symlink again. To prevent this occurring, ensure you 'stop' the Malware Remover QPKG in the App Center.

Hello! I want to mount a nfs folder automatically each time when the system startup. I found for few days and there is no official way to do this in the nas. The only way seems to run a script.
And it also seems that there is no official way to run the script automatically each time when the system startup.
Finally, I find this post and it seems that this is what I need.

BUT, it is saying that, the Malware Remover QPKG will remove the startup script.
I want to keep the Malware Remover qpkg and keep it running everyday to secure my files.
But, it is not make sense to run the installer manually every time...

Are there any other way that I can automatically run just one command at each startup in the qnap nas?
"mount -t nfs /my-nfs-ip:/nfsfolder /share/Public/nfsfolder"

my machine: qnap TS-453A

Thank you very much!
I just come up with an idea about this Malware Remover and the autorun.sh issue.

I think it is possible to do below:
1) Disable the Malware Remover so, it doesn't auto run when the system start.
2) keep the autorun.sh in somewhere else, or rename it so that we still have it after removing by the Malware Remover.

3) Make a autorun.sh to act below:
a) run the Malware remover manually and scan the system.
b) after scan finished, copy the autorun.sh to /tmp/config/autorun.sh
c) run the script that I need, in my case, mount the nfs (mount the nfs if it is not mounting at the moment.)
d) run this autorun.sh every 3am so that the Malware remover will run as usual and the autorun.sh will be go back to /tmp/config/autorun.sh everytime

If Malware remover is the only reason that this autorun.sh does not work automatically and my above idea is possible, I guess this may be a possible solution to make the autorun.sh script as well as the malware remover work again automatically.

However, are there anyone that can help to me write this script? I do not actually know how to write a script.
Any help?



-
barichon
New here
Posts: 5
Joined: Sat Aug 05, 2017 7:18 pm

Re: [SCRIPT] autorun.sh installer

Post by barichon »

Hello,

I installed it, here is the output:

Code: Select all

---| Details |-------------------------------------------------------
 * script version                   : 2017.02.12.01
 * NAS model                        : TS-X53II (TS-253A)
 * QTS version                      : 4.3.3 #20170727
 * default volume                   : /share/CACHEDEV2_DATA

---| Log |-----------------------------------------------------------
 √ DOM partition found              : /dev/sdc6
 √ mounted EXT2 DOM partition at    : /tmp/create-autorun.K5YKqj
 X Unable to confirm DOM partion size - proceed anyway
 √ backed-up existing autorun.sh to : /share/CACHEDEV2_DATA/.system/autorun/autorun.sh.prev.2
 √ unmounted EXT2 DOM partition     : /tmp/create-autorun.K5YKqj

---| Result |--------------------------------------------------------
 √ Autorun successfully installed!
My script is in:

Code: Select all

[/share/CACHEDEV2_DATA/.system/autorun/scripts] # ls -al
total 16
drwxrwx--x    2 admin    administ      4096 Aug  5 16:31 ./
drwxr-xr-x    3 admin    administ      4096 Aug  5 16:47 ../
-rwxrwx--x    1 admin    administ      2380 Aug  5 16:26 010-Start-up.sh*
But when I reboot my nothing happen :(
barichon
New here
Posts: 5
Joined: Sat Aug 05, 2017 7:18 pm

Re: [SCRIPT] autorun.sh installer

Post by barichon »

Hello guys,

Any help on this ? :(
khunpoom
New here
Posts: 8
Joined: Sun Oct 15, 2017 6:36 am

Re: [SCRIPT] autorun.sh installer

Post by khunpoom »

any updates?
my autorun also not working
how i can autorun my bash script at startup Qnap TS-469L (Intel Atom) with latest firmware or everybody going to install Ubuntu? :'
ETH 0xd8F2b22e50B200214303E4f0B95435c918ca9CcF
User avatar
OneCD
Guru
Posts: 12137
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] autorun.sh installer

Post by OneCD »

Not sure but I think there's now a setting to enable autorun in the QTS firmware. Can anyone confirm this?

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
khunpoom
New here
Posts: 8
Joined: Sun Oct 15, 2017 6:36 am

Re: [SCRIPT] autorun.sh installer

Post by khunpoom »

OneCD wrote:Not sure but I think there's now a setting to enable autorun in the QTS firmware. Can anyone confirm this?
yes! i find it :)
Screen_Shot_2017-10-16_at_10_33_45_AM.jpg
You do not have the required permissions to view the files attached to this post.
ETH 0xd8F2b22e50B200214303E4f0B95435c918ca9CcF
dulcifium
Been there, done that
Posts: 720
Joined: Fri Oct 23, 2009 6:52 pm

Re: [SCRIPT] autorun.sh installer

Post by dulcifium »

Is this still working on the latest firmware and with Entware (e.g. to set PATH variable)?
QNAP TS-639 Pro (3.8.1 Build 20121205) | 6 x 3 TB (Toshiba DT01ACA300 firmware MX6OABB0) | 12 TB RAID-6
Both shared over single port GbE and wifi router to Linux, Android, Windows, macOS and NVIDIA Shield
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: [SCRIPT] autorun.sh installer

Post by schumaku »

dulcifium wrote:Is this still working on the latest firmware ....
Yes - permitting it's enabled in the Control Panel :-0 .
dulcifium wrote:...and with Entware (e.g. to set PATH variable)?
Entware is installed as a QPKG and has it's own script for the start-up, ie. for handling the $PATH .
autorun control.PNG
This should answer your other follow-up post, too.
You do not have the required permissions to view the files attached to this post.
dulcifium
Been there, done that
Posts: 720
Joined: Fri Oct 23, 2009 6:52 pm

Re: [SCRIPT] autorun.sh installer

Post by dulcifium »

I can view it through Control Panel but there's no indication where to edit it...
QNAP TS-639 Pro (3.8.1 Build 20121205) | 6 x 3 TB (Toshiba DT01ACA300 firmware MX6OABB0) | 12 TB RAID-6
Both shared over single port GbE and wifi router to Linux, Android, Windows, macOS and NVIDIA Shield
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: [SCRIPT] autorun.sh installer

Post by schumaku »

dulcifium wrote:I can view it through Control Panel but there's no indication where to edit it...
...that's why the existing information on how to create and maintain the file remains valid. New is that it has to be enabled in the Control Panel, too.
User avatar
OneCD
Guru
Posts: 12137
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: [SCRIPT] autorun.sh installer

Post by OneCD »

schumaku wrote:...that's why the existing information on how to create and maintain the file remains valid. New is that it has to be enabled in the Control Panel, too.
Kurt, any word on how the Malware Remover handles autorun.sh now? A while back it would automatically remove this file (or symlink). Has this now changed?

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: [SCRIPT] autorun.sh installer

Post by schumaku »

Normally we're not deploying this App - with the autorun configured as per the QNAPedia and if it's enabled in the control panel, the file is retained.
Post Reply

Return to “Users' Corner”