STILL NOT SLEEPING! - and I GIVE UP!

Yes but the consistent 25 or 45 second wakeups are gone.

Don’t know enough about Samba either to know if that would be a (or the) problem with the periodic wake ups. “Nobody” is generally the guest account. Cannot add “nobody” through the Dashboard on my first gen due to the name being reserved.

You would think that nobody would be in your file?

Yes one would think so but it is not in my first gen smbpasswd file. No idea what to put in there as a value since in quick Googling I’m not finding a generic example of what a “nobody” smbpasswd entry looks like.

When I have a chance I’ll add a second generic user to populate the smbpasswd file with a second entry and see if that has any impact (probably won’t but its a troubleshooting step).

somebody check my log please

my S98user-start
is

/etc/rc2.d/S20restsdk-serverd stop
/etc/rc2.d/S84itunes stop
/etc/rc2.d/S85twonky stop
/etc/rc2.d/S85wdmcserverd stop
/etc/rc2.d/S86wdphotodbmergerd stop
/etc/init.d/wdmcserverd stop
/etc/init.d/wdphotodbmergerd stop
/etc/rc2.d/S60mDNSResponder stop
/etc/rc2.d/S92wdnotifierd stop
/etc/rc2.d/S61upnp_nas stop
/etc/rc2.d/S20winbind stop
/etc/rc2.d/S50netatalk stop

mount -o remount,noatime,nodiratime /dev/root /

and

WDMyCloud:~# pstree
init-±apache2—3*[apache2]
|-atop
|-atopacctd
|-cron
|-getty
|-ifplugd
|-lld2d
|-mdadm
|-monitorTemperat—sleep
|-monitorio.sh
|-nmbd
|-rpc.mountd
|-rpcbind
|-rsyslogd—3*[{rsyslogd}]
|-smbd—2*[smbd]
|-sshd-±2*[sshd—bash]
| -sshd---bash---pstree |-transmission-da---2*[{transmission-da}] |-udevd---2*[udevd] |-vsftpd |-wd-btnd -wdAutoMounter

and

grep standby /var/log/user.log (sorted by time)

|2017-12-07|00:01|
|2017-12-08|00:01|
|2017-12-09|00:01|
|2017-12-10|00:01|
|2017-12-11|00:01|
|2017-12-13|00:01|
|2017-12-08|00:18|
|2017-12-06|00:30|
|2017-12-07|00:30|
|2017-12-08|00:30|
|2017-12-09|00:30|
|2017-12-10|00:30|
|2017-12-11|00:30|
|2017-12-13|00:30|
|2017-12-06|00:40|
|2017-12-09|00:40|
|2017-12-10|00:40|
|2017-12-13|00:40|
|2017-12-07|00:42|
|2017-12-08|00:42|
|2017-12-11|00:42|
|2017-12-07|00:57|
|2017-12-10|00:57|
|2017-12-06|00:58|
|2017-12-08|01:01|
|2017-12-09|01:01|
|2017-12-11|01:01|
|2017-12-10|01:13|
|2017-12-06|01:17|
|2017-12-07|01:17|
|2017-12-06|01:49|
|2017-12-06|02:26|
|2017-12-07|02:42|
|2017-12-08|02:48|
|2017-12-09|02:48|
|2017-12-10|02:48|
|2017-12-11|02:48|
|2017-12-13|02:48|
|2017-12-07|02:55|
|2017-12-06|03:01|
|2017-12-07|03:01|
|2017-12-08|03:01|
|2017-12-09|03:01|
|2017-12-10|03:01|
|2017-12-11|03:01|
|2017-12-12|03:01|
|2017-12-13|03:01|
|2017-12-07|03:15|
|2017-12-08|03:15|
|2017-12-09|03:15|
|2017-12-10|03:15|
|2017-12-11|03:15|
|2017-12-13|03:15|

what shoud i do?

i think something is keeping waking periodically…

You could use these two scripts. You just need to replace the folder George with the folder you put the sleep.awk script.

File sleeptime.sh
gunzip -c /var/log/user.log.2.gz > tmpuserlog
cat tmpuserlog /var/log/user.log.1 /var/log/user.log|/nfs/George/sleep.awk
rm tmpuserlog

File sleep.awk
awk ’
NR==1 { a=substr($1,6,2); b=substr($1,9,2); c=substr($1,12,8); y=substr($1,1,4)}
{if ($7 ~ /after/){
hh1=int($8/3600)
mm1=int(($8%3600)/60)
ss1=($8%3600)%60
TotalSleep = TotalSleep + $8
printf “%2s %2s %8s %8s %5d %2d:%02d:%02d\n”,substr($1,6,2),substr($1,9,2) ,substr($11,0,9),substr($1,12,8),$8 ,hh1,mm1,ss1}}
END {
hh1=int(TotalSleep/3600)
mm1=mm1=int(($8%3600)/60)
ss1=($8%3600)%60
printf “Total Sleep Time: %2d:%02d:%02d\n” ,hh1,mm1,ss1
start= a “/” b “/” y " " c
“date +%Y”|getline year
end= substr($1,6,2) “/” substr($1,9,2) “/” year " " substr($1,12,8)
$1=start
#print start " " end
cmd=“date --date="”$1"" +%s"
#print cmd
cmd|getline st
printf “Start %s\n” ,st
$1=end
cmd=“date --date="”$1"" +%s"
cmd|getline end
#print cmd
printf “End %s\n” ,end
Total=end-st
hh1=int(Total/3600)
mm1=mm1=int((Total%3600)/60)
ss1=(Total%3600)%60
Percent=int((TotalSleep/Total)*100)
WakeTime= int(100 - Percent)
printf “Total Up Time: %2d:%02d:%02d %2d%% Sleep %2d%% Wake\n” ,hh1,mm1,ss1,Percent,WakeTime
}’

Some more experimenting. Set standby time to 5 minutes, default is 10 in: /etc/standby.conf

Removed sync, sync, sleep 10 from near the end of Monitorio.sh that was used to try and elliminate the 7/8 second wakeup and through some searching in past discussions on Monitorio, added the sync, sync, sleep part instead further up the script. After some experiementing I found that the longer time value I set the longer the unit will sleep before kicking back on to do some logging. Before I was getting the logging kicking the My Cloud awake ever 20 seconds or so after the unit went to sleep. Some quick testing shows the unit sleeping for more than one and a half hours before waking due to a PC on the network accessing the My Cloud. No idea if this change impacts other services or issues on the My Cloud.

Set sleep to two hours as a test and restart Monitorio: /etc/init.d/monitorio restart

    smartTestStatus=`getSmartTestStatus.sh | awk '{print $1}'`
    if [ "$standby_enable" == "enabled" ] && [ "$sleepcount" -eq "$standby_time" ] && [ "$smartTestStatus" != "inprogress" ]; then
        touch /tmp/standby
        enterStandbyTime=`date +%s`
        echo "Enter standby"

	# added sync/sleep code to deal with 7/8 second wakeups (12/13/17) 
        sync
        sync
        sleep 1200

        if [ "$1" == "debug" ]; then
                echo "`date`: Enter standby "
                dmesg -c > /dev/null
        fi

I don’t think your sleep issue is the same as mine. If I run samba my system will not sleep period. It is constantly accessing the /etc/smbpasswd file. Not sure yet why it is doing this. I don’t know if it has to do with the owner. For some reason the owner on my gen1 is George. On the gen2 it is admin.

Why did you change the sleep time to 2 hours? That means the system will be awake for 2 hours before is tries to sleep. Have you tried to let the system run without samba? Curious because the only thing that showed up on the checkgen1.sh script was the msg.sock.
AS I stated previously. When checking into the 7 second wake up. I found that the disk I/O that would wake the system had to do with things that monitorio.sh needed to run. I took that to mean that while the system was processing what originally woke it up. I caused some of the files used by monitorio.sh to be removed from cache. Therefore when it put the disk back to sleep it ended up calling some script or program that was not cached. This caused it to access the disk causing the 7 second wake up.

For what ever reason it seems my first gen sleeps longer, if I’m reading the results right, when I increased the sleep time from 5 or 10 to 600 (1 hour) or 1200 (2 hours) in Monitorio.sh. I’m just experimenting and throwing things against the wall at this stage. Partial sleep results:

12 13 09:54:26 09:54:46    20  0:00:20
12 13 10:12:05 10:12:25    20  0:00:20
12 13 10:22:36 10:38:31   955  0:15:55
12 13 10:48:42 12:13:39  5097  1:24:57  <-- sleep set to 600 in Monitorio.sh
12 13 12:42:21 12:42:41    20  0:00:20    <-- removed sleep setting in Monitorio.sh 
12 13 12:52:52 12:55:03   131  0:02:11
12 13 13:05:14 13:05:34    20  0:00:20
12 13 13:15:45 13:17:11    86  0:01:26
12 13 13:27:22 13:27:48    26  0:00:26
12 13 13:37:59 13:55:26  1047  0:17:27
12 13 14:24:59 14:25:19    20  0:00:20
12 13 14:47:32 16:27:43  6011  1:40:11 < -- sleep set to 1200 in Monitorio.sh
12 13 16:50:11 18:30:23  6012  1:40:12
Total Sleep Time: 21:40:12
Start 1512864123
End 1513207823
Total Up Time: 95:28:20 22% Sleep 78% Wake

If I kept the monitorio.sh script at stock and no commands to stop services in the user-script file my first gen doesn’t sleep much at all.

There is a problem with your changes. What is happening is that you put the script to sleep after it set the enterStandbyTime. Then you sleep for 600 or 1200. Then you put the disk to sleep. Set the led’s to show the sleep status. Then you go back to the beginning of the loop. then it finds that the disk woke up at some point. now it gets the current time and subtracts the enterStandbyTime to get the sleep time.
As a test watch the blue led. I don’t think it will go to the blue on and off that it does when sleeping. Also you could move the sleep before the enterStandbyTime is set.

Yeah figured I goofed when I previously edited that script after spending some time digging through it trying to understand what steps it is performing. Going back to stock firmware and starting over from scratch to do some more experimenting when I have a free moment. This sleep issue is frustrating and irritating, but for some reason it is like an itch that needs to be scratched. :laughing:

Some more experimenting. On a first gen v4.x, to fix the missing /tmp/dynamicconfig.ini file error message that shows up in the user.log file, the following seems to work when added to the s98user-start to get rid of the message. I rebooted My Cloud after adding this line.

touch /tmp/dynamicconfig.ini

Prompted by idle curiosity, I had a look at my gen1 dynamicconfig.ini file, and found that it seems to be defining the ports used for external access, and whether cloud access is enabled. So I’m not surprised that changing cloud access would either create or modify the file.

My gen1 only has one entry in the password file, and that’s the admin user. There’s only one user on the system.

‘nobody’ is used for some of the file ownerships.

If you do a stat /etc/samba/smbpasswd. Does the times displayed change every few minutes? Mine gets changed every few minutes. I’m trying to find out why some systems have this problem and some don’t.
Also if you look at the /var/log/samba/log.smbd* files do you see any errors? On my PC I map the My Cloud while logged in as user xxx. But user xxx does not exist on the My Cloud. I get different errors
about user xxx.

Bennor’s job works for me!

there were 10~20 sec wakeups.

after Bennor job, there is 1000 sec over wakeups.


before

2017-12-13 15:12 22 sec
2017-12-13 16:27 22 sec
2017-12-13 17:00 728 sec
2017-12-13 17:59 2306 sec
2017-12-13 18:19 22 sec
2017-12-13 18:44 263 sec
2017-12-13 20:17 22 sec
2017-12-13 20:42 109 sec
2017-12-13 21:10 23 sec
2017-12-13 21:37 369 sec
2017-12-14 00:12 23 sec
2017-12-14 01:23 22 sec
2017-12-14 02:48 3833 sec
2017-12-14 03:26 22 sec
2017-12-14 04:33 2798 sec
2017-12-14 08:01 11260 sec
2017-12-14 08:25 250 sec
2017-12-14 08:54 483 sec
2017-12-14 09:16 22 sec

after

2017-12-14 15:27 1207 sec
2017-12-14 16:01 1701 sec
2017-12-14 16:54 2926 sec
2017-12-14 17:27 1208 sec
2017-12-14 18:00 1661 sec
2017-12-14 18:27 1208 sec
2017-12-14 19:00 1673 sec
2017-12-14 21:36 1207 sec
2017-12-14 23:03 4901 sec
2017-12-15 00:00 3111 sec
2017-12-15 00:30 1494 sec
2017-12-15 00:57 1207 sec
2017-12-15 02:48 6033 sec
2017-12-15 03:13 1207 sec
2017-12-15 08:01 16839 sec
2017-12-15 08:38 1967 sec
2017-12-15 09:07 1411 sec
2017-12-15 09:41 1714 sec

Read the reply above. Bennor’s patch was incorrect.

No apparent change on my first gen to the smbpasswd file when checking over the space of half an hour.

stat /etc/samba/smbpasswd
  File: `/etc/samba/smbpasswd'
  Size: 104             Blocks: 8          IO Block: 4096   regular file
Device: 901h/2305d      Inode: 8519        Links: 1
Access: (0600/-rw-------)  Uid: (   33/www-data)   Gid: (   33/www-data)
Access: 2017-12-14 15:30:26.000000000 -0500
Modify: 2017-12-13 23:21:43.000000000 -0500
Change: 2017-12-14 19:58:34.000000000 -0500
 Birth: -

What time was this command run? The change time is 2 minutes to 8 PM.

I ran the command every couple of minutes in putty and it never changed over the course of half an hour between 8:00pm and 8:30pm. Just ran it again at 9:34pm and here are the results. Looks like it changed at approx 9:20pm

stat /etc/samba/smbpasswd
  File: `/etc/samba/smbpasswd'
  Size: 104             Blocks: 8          IO Block: 4096   regular file
Device: 901h/2305d      Inode: 8519        Links: 1
Access: (0600/-rw-------)  Uid: (   33/www-data)   Gid: (   33/www-data)
Access: 2017-12-14 15:30:26.000000000 -0500
Modify: 2017-12-13 23:21:43.000000000 -0500
Change: 2017-12-14 21:20:59.000000000 -0500