The S98user_start is a symbolic link to /CachVolume/user_start Make sure that it exists.
I checked /CachVolume/ and there is no user-start. Do I have to create it?
Other question is, can I just run the commands supposed to be put into the start script and they work alone or do they have to be executed in certain order?
Contains a symbolic link to the actual file. You should not have to create it. But that ‘e’ is important…
Sorry, in this case I just c&p the wording above. attached a screenshot from the directory you are referrinf to - there is neither a file nor a directory with that name oO
Thanks. I don’t know why I missed the e.
This is my CacheVolume
AbbottandCostello:/CacheVolume# ls -l
drwxr-xr-- 3 root root 4096 Jun 22 2015 WDPROT
-rw-rw-rw- 1 www-data www-data 109 Mar 8 2017 alert_notify_time
drwxrwxrwx 3 root root 4096 Dec 27 2014 cake
-rwxrwxrwx 1 root root 12 Sep 25 2015 last_firmware_info_sent
drwxr-xr-x 3 root root 4096 Dec 27 2014 netatalk
-rw-r–r-- 1 root root 2 May 28 2015 orion_cm_enabled
-rwxr-xr-x 1 root root 866 Sep 21 2015 share_acl_backup
drwxr-xr-x 2 root root 4096 Jul 12 2012 transcodingcache
drwxrwxrw- 6 root root 4096 Sep 25 2015 twonkymedia
-rw-rw-rw- 1 root root 34109 Jan 27 2016 update.log
drwxr-xr-x 3 root root 4096 Jan 27 2016 upgrade
-rwxrwxrw- 1 root root 940 Mar 3 2016 user-start
Have a look in /etc/rc2.d
If there is a symbolic link there, then you may have to create the actual user file /CacheVolume/user-start
Ah! Note that it should be a hyphen, not an underscore.
It’s so long since I did it that I can’t remember if there was an empty file there, or whether I had to create it.
Yes, there is a symbolic link and it’s red. It’s pointing into nowhere. So, I will create an empty file with no file extension at the target location and solely write the above commands into the file?
OK, I created this file, added all code into it as described above by @Bennor and restarted the Device. Then I checked the status:
and it’s all [ok] green.
So I seem to have missed something or did anything wrong. Apparently the script is not run on startup. If I run it manually I get:
-bash: /etc/rc2.d/S98user-start: Permission denied
Does the file need specific rights?
It needs 777 and root root
OK, I thought so. How would I do that? Sorry, my knowledge about Linux is nearly not existing.
EDIT: Ok, Google helps. I guess I ran Chmod 750 /etc/rc2.d/S98user-start
and after that it worked. (Not 100% sure which number I used behind Chmod - I’m at work right now and cannot check).
Then I restarted the drive and checked the status of the processed - voila - they remained deactivated.
I’m not sure what you meant about root root, though. Do I have to include the chmod action into my user-start script?
When you do the ls -l /CacheVolume. The first column is the file permissions and file type. d for directory l for link or - for regular file. Follow that by rwxrwxrwx which corresponds to the 777. In your case 750 is rwxr-x—
Column 3 and 4 are the owner and group. You use the chown root to change the owner to root. You use the chgrp root to change the group to root.
Ok, thanks for the explanation. I will have to try that as soon as I’m back home, although the user-start seemed to have been executed correctly at system startup without the root root already.
Sorry if my last question sounds stupid but do I have to apply the rights changes to the S98user-start link or to the actual user-start file?
To the user_start file. The odds are that the file already has root root since you were login as root when
you created the file.
You must be right, since I have not applied the changes to the NAS, yet but it was sleeping since last night when I created the start up script.
WDMyCloud:/DataVolume/shares/Public# sh sleeptime.sh
09 26 04:38:46 04:38:54 8 0:00:08 <-- Script initiated
09 26 04:49:05 08:52:42 14617 4:03:37 <-- accidental access of the Twonky Web interface when starting the browser that morning
09 26 09:02:53 17:38:33 30940 8:35:40 <-- Start of my PC but I have no drive mapping - so I do not know why wake up
09 26 17:48:44 18:01:37 773 0:12:53 <-- SSH access to run the sleep script
Total Sleep Time: 12:12:53
Total Up Time: 17:59:29 71% Sleep 29% Wake
Ok, that makes sense and having checked the directory, you are right:
-rwxrwxr-x 1 root root 493 Sep 26 03:27 user-start
According your description that must be 775, correct?!? I guess for my purpose it makes no difference…
Thanks so much for your support!
I will have an eye on my sleep times and might play around with the start up scripts from @rac8006, @Bennor and @Mona to see what brings the best results but overall I’m already satisfied that this ■■■■ thing finally is sleeping for a day or so.