Start script at boot time

Hi,
It seems that crontab isn’t working (I tried different things like creating a file at boot time, starting a script, etc… none of these worked).
Before I was able to write something, but now crontab resets itself a boot time.
I tried editing it with sudo crontab -e and crontab -e.
The line I added was either @reboot root echo “test” > /tmp/success, @reboot root mkdir /tmp/test or even @reboot mkdir /tmp/test.
So is there a way to start a script at boot time on my NAS ?
Thanks.

Hello, I’m not familiar with SSH and would not be able to assist, lets see if one of the more knowledgeable user is able to assist.

I hope so…

Someone ?

I’m trying to do the same, that I figured out until now is that the “typical” directories (as /etc) are created at boot time on ram disk (look the attached result of “df” command), so whatever file you add or modify will dissapear at boot time.

Filesystem 1K-blocks Used Available Use% Mounted on
%root% 55529 34548 18114 66% /
/dev/ram0 55529 34548 18114 66% /
mdev 257248 32 257216 0% /dev
/dev/sda3 999576 212140 760732 22% /boot
/dev/sda7 999576 2200 970672 0% /usr/local/config
/dev/loop0 102144 102144 0 100% /usr/local/modules
tmpfs 1024 0 1024 0% /mnt
tmpfs 40960 5536 35424 14% /var/log
tmpfs 102400 1600 100800 2% /tmp
/dev/sda4 951192 2852 931956 0% /mnt/HD_a4
/dev/sda2 3837304328 328455048 3469846780 9% /mnt/HD/HD_a2

I solved this problem by injecting my own code in the start.sh file from
Transmission (you can do the same with any app installed on your nas) which
injects my tasks in crontab.
However sometimes it does not work and the tasks aren’t being added in
crontab.
So yeah, My Cloud Mirror is good for file storage, price, torrents (when
you edited everything that could be edited to make it work properly), but
not for anything else :/.

Good for you. Please inform where this “start.sh” file is located at.

Yes, locate the place where the storage was mounted and follow this path
example
/mnt/HD/HD_a2/Nas_Prog/Transmission
Nas_Prog is the folder you are looking for. Maybe with the tool “find”
you’ll find it easily.

Hi,

I’ve founded howto use crontab and prevent reset of it after a reboot but pay attention becasue a mistake here can cause serius problems:

  1. ssh to the device

  2. Locate the file /usr/local/config/config.xml and edit it with vi

  3. locate the section cron and edit it inserting your own script, for example se below and look at fotobackup:


    10
    stime
    wd_crontab
    app_get_info
    ga_cron_q
    ga_cron_d
    auto_fw
    fotobackup
    random_check
    fw_available
    user_expire_chk
    dropnas_chk_usr

  4. locate below on the cron section and insert the correct parameters as below:


    3
    <1>10</1>
    <2>16</2>
    <3></3>
    <4>
    </4>
    <5>*</5>
    /mnt/HD/HD_a2/Nas_Prog/script/fotobackup.sh

This procedure assure you that every time you reboot the device all the crontab entry are in the same place. I suggest to copy the script and the config.xml file in a secure place because a firmware upgrade can change something. Take attention during firmware upgrade to compare the config.xml files to assure that are identical and eventual insert only the desidered rows in the new onle-
Another good point is that if you change settings with web gui the config.xml file change and will be reverted to the original, so you have to adjust it as needed.

Regards